[HOW TO]Spawn All? - 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: [HOW TO]Spawn All? (
/showthread.php?tid=93112)
[HOW TO]Spawn All? -
CaLaP - 23.08.2009
Hi,
How to spawn all player with a timer?
Thanks
Re: [HOW TO]Spawn All? -
Correlli - 23.08.2009
Use SetTimer/SetTimerEx with loop over SpawnPlayer function.
Re: [HOW TO]Spawn All? -
CaLaP - 23.08.2009
Thx. But i want all player re spawn
Re: [HOW TO]Spawn All? -
ronyx69 - 23.08.2009
Код:
forward RespawnAll();
public RespawnAll()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
SpawnPlayer(i);
}
}
Place anywhere in your script but NOT in a callback.
Then use it just as a normalfunction.
Re: [HOW TO]Spawn All? -
Frankylez - 23.08.2009
If you have a 50-slot server then using Ronyx's code would be a little pointless, unless you have undefined MAX_PLAYERS and redefined to 50!
Re: [HOW TO]Spawn All? -
CaLaP - 23.08.2009
Quote:
Originally Posted by Ronyx69
Код:
forward RespawnAll();
public RespawnAll()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
SpawnPlayer(i);
}
}
Place anywhere in your script but NOT in a callback.
Then use it just as a normalfunction.
|
Thanks. It works perfectly
Re: [HOW TO]Spawn All? -
SpiderPork - 23.08.2009
In my opinion, you should check if the player, which you will be spawning, is online, like this:
pawn Код:
forward SpawnAll();
public SpawnAll()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
SpawnPlayer(i);
}
}
}
Re: [HOW TO]Spawn All? -
Andom - 23.08.2009
Quote:
Originally Posted by SpiderPork
In my opinion, you should check if the player, which you will be spawning, is online, like this:
pawn Код:
forward SpawnAll(); public SpawnAll() { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { SpawnPlayer(i); } } }
|
Doesn't have to be, using if(IsPlayerConnected(i)) would take longer to do the loop, and since you cannot spawn a not-connected playerid you don't have to worry.