SA-MP Forums Archive
[Tutorial] Random spawns - 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: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Random spawns (/showthread.php?tid=162488)

Pages: 1 2 3


Re: Random spawns - Guest9328472398472 - 14.05.2012

Nice!

Thank You!


Re: Random spawns - JustinAn - 08.06.2012

Thanks, great tutorial


Re: Random spawns - Dodo9655 - 10.06.2012

Great tutorial, everything is well explained.


Re: Random spawns - [A]ndrei - 29.06.2012

thx alot i needed it.


Re: Random spawns - ErzaNatsu - 30.06.2012

hmm.. i have some problem..
but, Nice btw


Re: Random spawns - Captain_Mani - 08.08.2012

Thanks a lot! But how could I let not some skins get random spawned?


Re: Random spawns - Coder_ - 16.10.2012

Thanks for that nice Tut Helped n00bs


Re: Random spawns - donhu789 - 26.04.2013

nice JOb


Re: Random spawns - Wickeed - 13.06.2013

How to make random spawn for team,i mean, i have two teams and i need two other random spawn system


AW: Random spawns - Blackazur - 13.06.2013

like this or so:

Code:
if(team[playerid] == YOUR_TEAM]
{
new Float:RandomSpawns[][] = 
{
}
};



Re: Random spawns - AnonScripter - 12.09.2013

What if you have more than one team ??
i mean how to assign (team1) to spawn at this RandomSpawns area, and (team2) in another RandomSpawns area ?

if you know what i mean !


Re: Random spawns - FUNExtreme - 12.09.2013

Quote:
Originally Posted by AnonScripter
View Post
What if you have more than one team ??
i mean how to assign (team1) to spawn at this RandomSpawns area, and (team2) in another RandomSpawns area ?

if you know what i mean !
You follow the tutorial twice. And then in OnPlayerSpawn you check which team the player is in and then get coordinates from the correct array.

pawn Code:
OnPlayerSpawn(etc)
{
     if(playerteam == team1)
     {
           //Spawn code for team 1
     }
     else if(playerteam == team2)
     {
           //Spawn code for team 2
     }
     return 1;
}



Re: Random spawns - xVIP3Rx - 09.12.2013

Great tutorial.
PS, Sorry for bumping old thread, Meant to be elsewhere


Re: Random spawns - haZh - 25.08.2014

thank you FUNExtreme! this was useful.


Re: Random spawns - Glossy42O - 06.11.2014

Huge thanks.


Re: Random spawns - jamesmith12 - 18.07.2015

Thank you Thank you !


Re: Random spawns - SteSte - 06.04.2016

F:\PVP Server\gamemodes\pvp.pwn(403) : error 032: array index out of bounds (variable "RandomSpawns")
Can any one help me with this error, when I tried to create this command below, thats the error I recieved

CMD:joingame(playerid, params[])
{
new Random = random(sizeof(RandomSpawns));
SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);

return 1;
}


Re: Random spawns - SteSte - 06.04.2016

F:\PVP Server\gamemodes\pvp.pwn(403) : error 032: array index out of bounds (variable "RandomSpawns")
Can any one help me with this error, when I tried to create this command below, thats the error I recieved

CMD:joingame(playerid, params[])
{
new Random = random(sizeof(RandomSpawns));
SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);

return 1;
}


Re: Random spawns - JohnBlaze1971 - 06.04.2016

That means randomspawns is already defined.


Re: Random spawns - Kenxxx - 19.04.2016

What about If I SetPlayerCheckpoint(playerid, RandomSpawn[random][0], RandomSpawn[random][1], RandomSpawn[random][2], 5);
And I wanna get if Player IsPlayerInRangeOfPoint of the random point in SetPlayerCheckpoint what will I do ?
Sorry for my bad English