SA-MP Forums Archive
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: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Random spawns? (/showthread.php?tid=214453)



Random spawns? - Legit_V20 - 21.01.2011

I used to be a master at scripting but i havent done this shit for litterally 2-3 years and i have forgot a lot.
How do i make it so when a player dies they spawn at a random location, I already have the coordinates.
Thankyou!


Re: Random spawns? - Sascha - 21.01.2011

pawn Код:
new Float:RandomSpawn[][4] = {
    {coordx, coordy, coordz, coorda},
    {coordx, coordy, coordz, coorda},
    {coordx, coordy, coordz, coorda}
};

public OnPlayerSpawn(playerid)
{
    new rands = random(sizeof(RandomSpawn));
    SetPlayerPos(playerid, RandomSpawn[rands][0], RandomSpawn[rands][1], RandomSpawn[rands][2]);
    SetPlayerFacingAngle(playerid, RandomSpawn[rands][3]);
    return 1;
}



Re: Random spawns? - HyperZ - 21.01.2011

https://sampwiki.blast.hk/wiki/Random