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.