Question about this loop - 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: Question about this loop (
/showthread.php?tid=484650)
Question about this loop -
Riwerry - 31.12.2013
Hello guys I have a question, is this loop same like the down one?
pawn Код:
new x=0;
while(x != MAX_PLAYERS)
{
if(IsPlayerConnected(x) && GetPlayerState(x) != PLAYER_STATE_NONE)
{
SetPlayerTime(x, hours, minutes);
}
x++;
}
to
pawn Код:
for (new x = 0; x<MAX_PLAYERS; x++)
{
if (IsPlayerConnected(x) && GetPlayerState(x) != PLAYER_STATE_NONE) //but i dunno if here is != PLAYER_STATE_NONE or ==
{
SetPlayerTime(x, hours, minutes);
}
}
Thanks guys!
Re: Question about this loop -
Jessyy - 31.12.2013
yes...
Re: Question about this loop -
Riwerry - 31.12.2013
yeah mate and here should be in the for (new...) way
if (IsPlayerConnected(x) && GetPlayerState(x) != PLAYER_STATE_NONE)
!= PLAYER_STATE_NONE)
or this == PLAYER_STATE_NONE)
Re: Question about this loop -
SilentSoul - 31.12.2013
It's up to your choice , if you want if his state equal to NON then use '==' equal too if you want to continue saving his time if the player state not equal NONE use '!=' Not equal.