[HELP] Discord rich presence 128 Slots Player count

I try to do live player count for the discord rich presence I try this but is not working

local appid = 'appid'
local asset = 'assetid'
Citizen.CreateThread(function()
    while true do
        Citizen.Wait(2500)
		players = {}
		for i = 0, 127 do
			if NetworkIsPlayerActive( i ) then
				table.insert( players, i )
			end
		end
                local name = GetPlayerName(PlayerId())
		local id = GetPlayerServerId(PlayerId())
		SetRichPresence("ID: " .. id .. " | " .. name .. " | " .. #players .. "/128")
		SetDiscordAppId(appid)
		SetDiscordRichPresenceAsset(asset)
    end
end)

After searching the forum I found a possible alternative that was this

Change for loop for

local players = NetworkGetNumConnectedPlayers()

But it didn’t work properly either, I will have this topic to know if anyone can help me.

Have you tried

print(#GetActivePlayers())

error, can you post the full code ? i try to add this on SetRichPresence and on a players variable but is not working for me

1 Like
local appid = 'appid'
local asset = 'assetid'
Citizen.CreateThread(function()
    while true do
        Citizen.Wait(2500)
		local player = PlayerId()
        local name = GetPlayerName(player)
		local id = GetPlayerServerId(player)
		SetRichPresence("ID: " .. id .. " | " .. name .. " | " .. #GetActivePlayers() .. "/128")
		SetDiscordAppId(appid)
		SetDiscordRichPresenceAsset(asset)
    end
end)
2 Likes

Idk why, but no works for me

i finish him https://github.com/Ren0X1/rnx_discord

Yeah the link is down*