SA-MP Forums Archive
Random Tele :D - 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: Random Tele :D (/showthread.php?tid=210805)



Random Tele :D - Rokzlive - 13.01.2011

Ok, i want to make a command /randomtele

I know how to make the command (obviously) but heres what i need.

I need it so that when they enter that command it sends them to one of these points at random.

pawn Код:
SetPlayerPos(playerid,2118.0212,-2173.2434,18.5469);
    SetPlayerPos(playerid,2829.9478,918.4404,10.7500);
    SetPlayerPos(playerid,1681.0226,975.8158,10.7789);
    SetPlayerPos(playerid,1069.5417,1268.4760,10.8203);
    SetPlayerPos(playerid,-84.7425,-1126.5870,1.0781);
    SetPlayerPos(playerid,-488.8553,-534.6000,25.5296);
    SetPlayerPos(playerid,-2162.8982,-225.4068,36.5156);



Re: Random Tele :D - Retardedwolf - 13.01.2011

pawn Код:
COMMAND:randtele( playerid, params [ ] )
{
    new randInt = random ( 6 );
    switch ( randInt )
    {
        case 0: SetPlayerPos(playerid,2118.0212,-2173.2434,18.5469);
        case 1: SetPlayerPos(playerid,2829.9478,918.4404,10.7500);
        case 2: SetPlayerPos(playerid,1681.0226,975.8158,10.7789);
        case 3: SetPlayerPos(playerid,1069.5417,1268.4760,10.8203);
        case 4: SetPlayerPos(playerid,-84.7425,-1126.5870,1.0781);
        case 5: SetPlayerPos(playerid,-488.8553,-534.6000,25.5296);
        case 6: SetPlayerPos(playerid,-2162.8982,-225.4068,36.5156);
    }
    return 1;
}



Re: Random Tele :D - admantis - 13.01.2011

Quote:
Originally Posted by Retardedwolf
Посмотреть сообщение
pawn Код:
COMMAND:randtele( playerid, params [ ] )
{
    new randInt = random ( 6 );
    switch ( randInt )
    {
        case 0: SetPlayerPos(playerid,2118.0212,-2173.2434,18.5469);
        case 1: SetPlayerPos(playerid,2829.9478,918.4404,10.7500);
        case 2: SetPlayerPos(playerid,1681.0226,975.8158,10.7789);
        case 3: SetPlayerPos(playerid,1069.5417,1268.4760,10.8203);
        case 4: SetPlayerPos(playerid,-84.7425,-1126.5870,1.0781);
        case 5: SetPlayerPos(playerid,-488.8553,-534.6000,25.5296);
        case 6: SetPlayerPos(playerid,-2162.8982,-225.4068,36.5156);
    }
    return 1;
}
Change
pawn Код:
new randInt = random ( 6 );
to
pawn Код:
new randInt = random ( 7 );
There are 7 positions, not 6.


Re: Random Tele :D - Rokzlive - 13.01.2011

tyty


Re: Random Tele :D - Retardedwolf - 13.01.2011

@admantis, Numbers start from 0 ( zero ).