SA-MP Forums Archive
2 teleports to one place - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: 2 teleports to one place (/showthread.php?tid=231472)



2 teleports to one place - Beginnercoder - 25.02.2011

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?


Re: 2 teleports to one place - park4bmx - 25.02.2011

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


Re: 2 teleports to one place - Stigg - 25.02.2011

Here:

Random spawn positions.

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

Too late lol


Re: 2 teleports to one place - Beginnercoder - 25.02.2011

Thanks.


Re: 2 teleports to one place - Beginnercoder - 25.02.2011

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}
};



Re: 2 teleports to one place - Stigg - 25.02.2011

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


Re: 2 teleports to one place - Mean - 25.02.2011

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 ^^.


Re: 2 teleports to one place - Beginnercoder - 25.02.2011

Figured it out my self but thank you anyway.