Need help for random spawns
#6

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.00.00.00.0},
    {
5.49.210.50.0},
    {
800.0,100.6,50.70.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(playeridRandomSpawn[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(playeridRandomSpawn[rnd][3]); //Last the facing angle
    
return 1;

You can throw that code on player spawn instead of this command
Reply


Messages In This Thread
Need help for random spawns - by Westpoint - 05.08.2017, 06:27
Re: Need help for random spawns - by crukk11 - 05.08.2017, 06:46
Re: Need help for random spawns - by Naveen123 - 05.08.2017, 06:47
Re: Need help for random spawns - by Naveen123 - 05.08.2017, 06:51
Re: Need help for random spawns - by crukk11 - 05.08.2017, 06:54
Re: Need help for random spawns - by FailerZ - 05.08.2017, 07:03

Forum Jump:


Users browsing this thread: 1 Guest(s)