IsPlayerConnected question
#2

It's better to use it because it will skip players are not connected and save memory, else it will just set health of a player that's not even connected.

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if (!IsPlayerConnected(i)) continue;
    SetPlayerPos(i, x, y, z);
}
I still and will always recommend foreach, easy and faster than ever loops.
pawn Код:
foreach(Player, i)
{
    SetPlayerPos(i, x, y, z);
}
Checking if the player is online is not even needed in that case.
Reply


Messages In This Thread
IsPlayerConnected question - by BlackWolf120 - 29.04.2011, 20:51
Re: IsPlayerConnected question - by admantis - 29.04.2011, 20:59
Re: IsPlayerConnected question - by Mr.GeEk - 29.04.2011, 21:01
Re: IsPlayerConnected question - by admantis - 29.04.2011, 21:02
Re: IsPlayerConnected question - by BlackWolf120 - 29.04.2011, 21:04
Re: IsPlayerConnected question - by xir - 29.04.2011, 21:05
Re: IsPlayerConnected question - by BlackWolf120 - 29.04.2011, 21:09
Re: IsPlayerConnected question - by Vince - 29.04.2011, 22:09
Re: IsPlayerConnected question - by BlackWolf120 - 29.04.2011, 22:16
Re: IsPlayerConnected question - by BlackWolf120 - 30.04.2011, 11:59

Forum Jump:


Users browsing this thread: 1 Guest(s)