cfx-server-data
cfx-server-data copied to clipboard
Causing tons of massive timeouts for players
- Updated the method to loop through players, so this will no longer cause timeouts
You don't need to use NetworkIsPlayerActive in the GetActivePlayers loop. Since it only lists active players.
The loop before was only looping through 31 players and was causing massive hitches. This code fixes the problem. I only implemented the fix for 31 players, but you are correct, that part of the code can be removed also.
or use NETWORK_GET_PLAYER_INDEX_FROM_PED
?
and why adding Citizen.Wait
Oh true we could use that too. The code before was causing massive timeouts and lag, so I fixed that part. Room for optimization of course still
What's the intent of this PR? Will this be improved by just using GetActivePlayers()
and reverting change on line 7?
Precisely. It's a simple fix, but I found it odd that its not using the much safer GetActivePlayers()
and instead using a loop of 32.