23.03.2010, 16:15
Try using
Instead of
The top one is faster and eats less resources.
MAX_PLAYERS has a static value of 500.
GetMaxPlayers(); has a dynamic value of the server max players (set in your server.cfg).
So it's a waste looping through 500 people if there is only 10 online.
You can also try using IsPlayerConnected, but I think the script would have to go through each player and check if their connected, which would be slow.
Код:
for(new a, b = GetMaxPlayers(); a < b; a++)
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
MAX_PLAYERS has a static value of 500.
GetMaxPlayers(); has a dynamic value of the server max players (set in your server.cfg).
So it's a waste looping through 500 people if there is only 10 online.
You can also try using IsPlayerConnected, but I think the script would have to go through each player and check if their connected, which would be slow.