SA-MP Forums Archive
I have a loop problem.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: I have a loop problem.. (/showthread.php?tid=464396)



I have a loop problem.. - sansk - 16.09.2013

Can anyone make a loop that keeps going if i == playerid?
I tried something like this
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
		{
		    if(i == playerid; < MAX_PLAYERS) return i++;



Re: I have a loop problem.. - Konstantinos - 16.09.2013

When you're saying "that keeps going", do you mean to skip it if i is equal to playerid?
If so:
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(!IsPlayerConnected(i) || i == playerid) continue;
    // code;
}
By the way, skip the offlines players.


Re: I have a loop problem.. - sansk - 16.09.2013

THANK YOU SO MUCH you saved my day +REP