2 teleports to one place
#1

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?
Reply
#2

pawn Код:
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 :)
This would help ya 2 https://sampwiki.blast.hk/wiki/Random
Reply
#3

Here:

Random spawn positions.

https://sampwiki.blast.hk/wiki/Random

Too late lol
Reply
#4

Thanks.
Reply
#5

Warning 213, tag mismatch.

I get this when I put this at the top.

pawn Код:
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}
};
Reply
#6

Have a closer look at the https://sampwiki.blast.hk/wiki/Random thing, you'll see where your going wrong.
Reply
#7

Better use:
pawn Код:
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;
}
Ofc, replace the x, y, z with the X Y and Z you want to tele. It will choose one of thoose ^^.
Reply
#8

Figured it out my self but thank you anyway.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)