Just a quick hint: when writing new client-side scripts in Lua/JS (C# already has the Players
list doing exactly this), you can loop through players by using the GET_ACTIVE_PLAYERS native. See below for an example of before/after:
Before…
for i = 0, 255 do if NetworkIsPlayerActive(i) then local ped = GetPlayerPed(i) -- do stuff end end
After…
for _, player in ipairs(GetActivePlayers()) do local ped = GetPlayerPed(player) -- do stuff end
This should be a bit more performant than 256 native invocations, even if no player slot exists, and it also doesn’t differ based on server-side sync technology slot count – all players with an active ped should be returned by this native.