SA-MP Forums Archive
Assigning multiple locations to AddPlayerClass? - 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: Assigning multiple locations to AddPlayerClass? (/showthread.php?tid=415283)



Assigning multiple locations to AddPlayerClass? - Da_Noob - 12.02.2013

Is there a way to assign multiple spawn locations to an AddPlayerClass? I want to make multiple maps, so whenever 1 round ends, and the other rounds start, I want them to spawn on another location.
I've been thinking about making global variables, like so:

pawn Код:
new Map1;
new Map2;
And then, when Map1 is playing, set Map1 to 1 and Map2 to 0. Then whenever the timer stops, so the round ends, it sets Map1 to 0 and Map2 to 1.

Then Under OnGameModeInit:

pawn Код:
if(Map1 == 1)
{
AddPlayerClass(/* the rest here */)
}
else if(Map2 == 1)
{
AddPlayerClass(/* the rest here */)
}
Will this work or not? And if not, is there any other way to do it?


Re: Assigning multiple locations to AddPlayerClass? - DaRk_RaiN - 12.02.2013

If you want random spawns use SetPlayerPos on OnPlayerSpawn, if you want random spawns for one character use RandomSpawn


Re: Assigning multiple locations to AddPlayerClass? - Da_Noob - 12.02.2013

Oh, I think I know what you mean. So, will this work?

Under OnPlayerSpawn:

pawn Код:
if(Map1 == 1)
{
SetPlayerPos(...)
}
else if(Map2 == 1)
{
SetPlayerPos(...)
}



Re: Assigning multiple locations to AddPlayerClass? - DaRk_RaiN - 12.02.2013

Yes that way.


Re: Assigning multiple locations to AddPlayerClass? - Da_Noob - 12.02.2013

Sorry ******...
Got it worked now. Thanks!