05.08.2017, 07:03
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;
}