PDA

View Full Version : for loop question


HurtLocker
02/04/2013, 02:56 PM
I want to use this loop :for(new i=0; i<MAX_PLAYERS; i++) but i want to make X loops where X is the connected players number and not the MAX_PLAYERS value, but not with this format: for(new i=0; i<MAX_PLAYERS; i++)
if (IsPlayerConnected(i))
{

}
My question is, is there any format to enter instead of "MAX_PLAYERS"?

Konstantinos
02/04/2013, 02:58 PM
http://forum.sa-mp.com/showthread.php?t=92679


Note that this IS NOT a simple definition to insert the normal loop, it's actually a completely different implementation using lists of players, making it faster that the normal system. Furthermore, because of the way it works, it doesn't matter what MAX_PLAYERS is, whether it's correct for your server or not, this loop will always take the same amount of time as it ONLY loops through connected players, not unconnected players.

HurtLocker
02/04/2013, 03:00 PM
Thanks a lot.