Random Tele :D
#1

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);
Reply
#2

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;
}
Reply
#3

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.
Reply
#4

tyty
Reply
#5

@admantis, Numbers start from 0 ( zero ).
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)