Spawning in an order? - 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 in an order? (
/showthread.php?tid=267230)
Spawning in an order? -
Antonio144 - 07.07.2011
Hello.
Is it possible to spawn players in order?
Like if a player connects to a server and than he spawns than the second player comes but he get spawned at the second location, third player third location etc and if second player quits that the fourth player who come gets spawned at second location..
Is that possible?
Thanks!
Re: Spawning in an order? -
Antonio144 - 07.07.2011
Anyone?
Re: Spawning in an order? -
[MG]Dimi - 07.07.2011
Probably is possible but may be hard to script.
Re: Spawning in an order? -
grand.Theft.Otto - 07.07.2011
Hmm, you could use something to get the players ID, so whatever ID they have, corresponds to what spawn they get. Not sure how to do it, but try this:
https://sampwiki.blast.hk/wiki/GetPlayerID
Re: Spawning in an order? -
=WoR=Varth - 08.07.2011
pawn Код:
public OnPlayerSpawn(playerid)
{
if(playerid == 0) SetSpawnInfo(playerid,team,skin,Float:x,Float:y,Float:z,Float:rotation,weapon1,weapon1_ammo,weapon2,weapon2_ammo,weapon3,weapon3_ammo);
if(playerid == 1) SetSpawnInfo(playerid,team,skin,Float:x,Float:y,Float:z,Float:rotation,weapon1,weapon1_ammo,weapon2,weapon2_ammo,weapon3,weapon3_ammo);
//Add as many as you like
SpawnPlayer(playerid);
return 1;
}
EDIT: Or maybe you want to use SetPlayerPos.
Re: Spawning in an order? -
[MG]Dimi - 08.07.2011
Quote:
...and if second player quits that the fourth player who come gets spawned at second location...
|
Point is to order locations not player ids. Maybe defining spawn locations and then using tons of
codes?
Re: Spawning in an order? -
Hipflop - 08.07.2011
Quote:
Originally Posted by [MG]Dimi
Point is to order locations not player ids. Maybe defining spawn locations and then using tons of codes?
|
Quote:
Originally Posted by varthshenon
pawn Код:
public OnPlayerSpawn(playerid) { if(playerid == 0) SetSpawnInfo(playerid,team,skin,Float:x,Float:y,Float:z,Float:rotation,weapon1,weapon1_ammo,weapon2,weapon2_ammo,weapon3,weapon3_ammo); if(playerid == 1) SetSpawnInfo(playerid,team,skin,Float:x,Float:y,Float:z,Float:rotation,weapon1,weapon1_ammo,weapon2,weapon2_ammo,weapon3,weapon3_ammo); //Add as many as you like SpawnPlayer(playerid); return 1; }
EDIT: Or maybe you want to use SetPlayerPos.
|
The code above should work. When someone leaves with playerid 2, the next one that connects is automatically playerid 2.
Re: Spawning in an order? -
[MG]Dimi - 08.07.2011
But if player id 4 dies and player id 2 isn't connected id 4 should spawn on 2's position. That's how I have understood.
Re: Spawning in an order? -
Antonio144 - 08.07.2011
Thanks guys for all the help. I put slots on every spawn point, so when player spawns on Spawn point 1 that Slot1 = 1; than when secound player connects it checks Spawn point 1 if its 1 than moves to spawn point 2 etc.
I have i new problem
I'm making a derby and almost everything is ready. I just can't figure out how to make that the last guy "standing" is the winner. Any of you know how?
Thanks.