Need help for 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)
+--- Thread: Need help for random spawns (
/showthread.php?tid=638711)
Need help for random spawns -
Westpoint - 05.08.2017
Hi guys,
I've been trying to make random spawns as i'm a new scripter and scripting my new tdm script, But i've created teams and i want to add random spawns for a team. Anyone help?!
Re: Need help for random spawns -
crukk11 - 05.08.2017
https://sampforum.blast.hk/showthread.php?tid=273529
Re: Need help for random spawns -
Naveen123 - 05.08.2017
friend i need your help please help me i'm tired
Re: Need help for random spawns -
Naveen123 - 05.08.2017
can you help me please how to install zadmin 4.2 my pc
Re: Need help for random spawns -
crukk11 - 05.08.2017
https://sampforum.blast.hk/showthread.php?tid=279892#
search the ### INSTALLATION:
Re: Need help for random spawns -
FailerZ - 05.08.2017
PHP код:
new Float:RandomSpawn[][4] = //Here we create an 2D to hold the random spawns (Don't forget the float tag because coordinations are float.
{
//Add locations X, Y, Z, Facing Angle (Throw your random locations here)
{0.0, 0.0, 0.0, 0.0},
{5.4, 9.2, 10.5, 0.0},
{800.0,100.6,50.7, 0.0}
};
CMD:spawn(playerid) //A small command will teach you how to grab the random location
{
new rnd = random(sizeof(RandomSpawn)); //Here we declare a new variable to hold the random number of the row in the array (size of random spawn here returns 3 because we have 3 locations set) (random will return random one of them)
SetPlayerPos(playerid, RandomSpawn[rnd][0], RandomSpawn[rnd][1], RandomSpawn[rnd][2]); //Now that we got the random number we just set the x which is in the column 0 and y in col 1 and z in col 2..
SetPlayerFacingAngle(playerid, RandomSpawn[rnd][3]); //Last the facing angle
return 1;
}
You can throw that code on player spawn instead of this command