SA-MP Forums Archive
Spawning all players at once? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Spawning all players at once? (/showthread.php?tid=93036)



Spawning all players at once? - (.Aztec); - 23.08.2009

I'm making a gamemode where it's basically a Attack n' Defend, and i want that if one player reaches a specific point and types a command (/capture), then it will spawn all players back, and send a GameTextForAll saying the round has ended, et cetera. So, i was wondering.. Is there a function that can spawn all players at once? (And that hopefully won't cause my server to go "Fuck this." and die.)

Thanks in advance,

Sky.


Re: Spawning all players at once? - JaTochNietDan - 23.08.2009

Simply use a loop to go through all of your players and spawn them using SpawnPlayer(); like so:

pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
  if(IsPlayerConnected(i))
  {
    SpawnPlayer(i);
  }
}
GameTextForAll("Round has ended..",5000,3);
However I recommend using foreach instead of a loop, this is only an example


Re: Spawning all players at once? - (.Aztec); - 23.08.2009

Quote:
Originally Posted by JaTochNietDan
Simply use a loop to go through all of your players and spawn them using SpawnPlayer(); like so:

pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
  if(IsPlayerConnected(i))
  {
    SpawnPlayer(i);
  }
}
GameTextForAll("Round has ended..",5000,3);
However I recommend using foreach instead of a loop, this is only an example
Hmm, thanks mate! I'm going to try using the spawnplayer part right now, thanks again!

EDIT: Thanks, worked GREAT!