What does loop return if not connected? - 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: What does loop return if not connected? (
/showthread.php?tid=372220)
What does loop return if not connected? -
Lukks90 - 25.08.2012
Hi, i have one question it's what does loop return if player is not connected,does it skip or goes back and try again until finds some player thats connected
Код:
{
if(GetPlayerTeam(i) == randomorg)
{
if(IsPlayerConnected(i))
{
PlayerList[idx] = i;
idx++;
}
}
}
So if there isnt any player in team "randomorg" would script go back and check again or just go on and do like if it has selected player?
If anyone undertood me i would like help

Help fellow scripter

Thanks in advance!
Re: What does loop return if not connected? -
Shetch - 25.08.2012
If the player isn't connected, the loop would simply do nothing and continue looping through the other players.
Re: What does loop return if not connected? -
Sniper Kitty - 25.08.2012
The 'for' statement is very simple.
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++) {
//code here.
}
Is exactly like.
pawn Код:
new i = 0;
Loop:
if(i < MAX_PLAYERS) {
//code here.
i++;
goto Loop;
}
Re: What does loop return if not connected? -
Lukks90 - 25.08.2012
i know about
for but i like it old style

@Shetch so its like this i have situation where,script selects random team,and selects random player inside that team,what if there are no players online in randomed team,what would then happend would loop go back and look for another team that has players or would it behave like it selected player?
P.S Thanks for reply