how to make a random spawn? - 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: how to make a random spawn? (
/showthread.php?tid=294393)
how to make a random spawn? -
niels44 - 01.11.2011
hey everyone,
i want to make a random spawn becuz everytime when there are like 10 or 15 players in my server they kill each other and i dont want that so how to make a random spawn? i made it like this but it isnt working it now goes to 1 place:
Код:
public OnPlayerSpawn(playerid)
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 2614.5420,-2468.1777,3.0000);
SetPlayerPos(playerid, 2644.9099,-2022.1721,13.5469);
SetPlayerPos(playerid, -2706.4773,218.7441,4.1797);
return 1;
}
someone can tell me how to make it that everytime a player respawns he goes to another place?
niels
Re: how to make a random spawn? - HuSs3n - 01.11.2011
Код:
//on the top
new Float:Rs[][4] =
{
{2614.5420,-2468.1777,3.0000, 192.0335},
{2644.9099,-2022.1721,13.5469, 267.2932},
{-2706.4773,218.7441,4.1797, 89.8853}
//replace/and add more spawns here
};
//on player spawn
public OnPlayerSpawn(playerid)
{
new rand = random(sizeof(Rs));
SetPlayerPos(playerid,Rs[rand][0], Rs[rand][1],Rs[rand][2]);
SetPlayerFacingAngle(playerid,Rs[rand][3]);
return 1;
}
Re: how to make a random spawn? -
niels44 - 01.11.2011
nice man i would never figured that out my self XD thanks bro REP +
Re: how to make a random spawn? -
Edvin - 01.11.2011
Код:
new Float:gRandomPlayerSpawns[ 5 ][ 3 ] = {
{ Pos1 },
{ Pos2 },
{ Pos3 },
{ Pos4 },
{ ect }
};
and now on: OnPlayerSpawn:
Код:
SetPlayerRandomSpawn( playerid );
And thats all...