cfx-server-data icon indicating copy to clipboard operation
cfx-server-data copied to clipboard

Causing tons of massive timeouts for players

Open JaredScar opened this issue 5 years ago • 6 comments

  • Updated the method to loop through players, so this will no longer cause timeouts

JaredScar avatar Dec 15 '19 03:12 JaredScar

You don't need to use NetworkIsPlayerActive in the GetActivePlayers loop. Since it only lists active players.

smallo92 avatar Dec 15 '19 03:12 smallo92

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.

JaredScar avatar Dec 15 '19 04:12 JaredScar

or use NETWORK_GET_PLAYER_INDEX_FROM_PED ? and why adding Citizen.Wait

PichotM avatar Dec 15 '19 04:12 PichotM

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

JaredScar avatar Dec 15 '19 04:12 JaredScar

What's the intent of this PR? Will this be improved by just using GetActivePlayers() and reverting change on line 7?

cerium-cfx avatar May 04 '20 20:05 cerium-cfx

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.

JaredScar avatar May 05 '20 17:05 JaredScar