SA-MP Forums Archive
Is class select ignored by for loops? - 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: Is class select ignored by for loops? (/showthread.php?tid=575951)



Is class select ignored by for loops? - Aerotactics - 31.05.2015

What I mean is, say I wan't to set every player's interior in the server to the same interior at the same time using a for loop. Would this loop also effect anyone in class selection?


Re: Is class select ignored by for loops? - dominik523 - 31.05.2015

It could do that, yeah. I'm not quite sure.
You could create variable bool:Alive[MAX_PLAYERS] and set it to true each time player spawns. When they die, set it to false and so on. In the loop, just check if the player is alive and set their interior.


AW: Is class select ignored by for loops? - NaS - 31.05.2015

Simply get the player's states within the loop, if it's on foot/driver/passenger you can set the interior. Otherwise they are dead, not spawned, spectating, etc..


Re: Is class select ignored by for loops? - Vince - 31.05.2015

Don't even need a variable. Use GetPlayerState instead and ignore anyone with PLAYER_STATE_NONE and PLAYER_STATE_WASTED.

Edit: ^


Re: Is class select ignored by for loops? - Aerotactics - 31.05.2015

Quote:
Originally Posted by Vince
Посмотреть сообщение
Don't even need a variable. Use GetPlayerState instead and ignore anyone with PLAYER_STATE_NONE and PLAYER_STATE_WASTED.

Edit: ^
Thanks Vince!