25.02.2011, 19:00
Hi I have made a teleport to Montgomery but when everyone teleports there, they all go to the same spot, how do I make random teleports to the place so they all go to different spots?
new Float:RandomSpawn[3][3] =
{
// Positions, (X, Y, Z)
{x,y,z}, //put your diffrenet position here
{x,y,z},
{x,y,z}
};
//and the when the player types the command
new rand = random(sizeof(RandomSpawn));
SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
// and your done :)
new Float:RandomSpawn[][4] =
{
{-2796.9854, 1224.8180, 20.5429, 192.0335},
{-2454.2170, 503.8759, 30.0790, 267.2932},
{-2669.7322, -6.0874, 6.1328, 89.8853}
};
TheTeleportCommand( ... )
{
new rand = random( 5 ); // 5 diffrent positions
switch( rand )
{
case 0: SetPlayerPos( playerid, x, y, z );
case 1: SetPlayerPos( playerid, x, y, z );
// And so on...
}
return 1;
}