SA-MP Forums Archive
Action for all players. - 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: Action for all players. (/showthread.php?tid=279585)



Action for all players. - Superthijs - 28.08.2011

How do I set an action for all players?
I want to make a race and use SetPlayerRaceCheckpoint, but for all players.


Re: Action for all players. - Bakr - 28.08.2011

Use a loop that goes through all players
pawn Code:
for( new i = 0; i < MAX_PLAYERS; i++ ) // Loop through all players
{
   if( !IsPlayerConnected( i ) ) continue; // They're not connected, goto the next player slot (iteration)
   SetPlayerRaceCheckpoint( i, ... ); // Set the checkpoint
}



Re: Action for all players. - =WoR=Varth - 28.08.2011

https://sampwiki.blast.hk/wiki/Control_Structures#Loops
https://sampwiki.blast.hk/wiki/Loops