random checkpoints
#1

any idea how to make random checkpoints ?
example:
pawn Код:
CMD:mission(playerid, params[])
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        SetPlayerCheckpoint(playerid, random);
    }
    return 1;
}
Reply
#2

pawn Код:
new const Float:RandomCPs[][3] = {
{0.0,0.0,0.0},
{541.0,0.54,0.4}
}; // so on

CMD:mission(playerid, params[])
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new rand = random(sizeof(RandomCPs));
        SetPlayerCheckpoint(playerid, RandomCPs[rand][0],RandomCPs[rand][1],RandomCPs[rand][2],5.0);
    }
    return 1;
}
But it doesn't have to be global:
pawn Код:
CMD:mission(playerid, params[])
{
    if(IsPlayerInAnyVehicle(playerid))
    {
         new rand = random(2),Float:X,Float:Y,Float:Z;
         switch(rand)
         {
               case 0: {X = 5.1; Y = 1.2; Z = 53.5;}
               case 1: {X = 5114.23; Y = 125.6; Z = 125432.512;}
          }
        SetPlayerCheckpoint(playerid, X,Y,Z,5.0);
    }
    return 1;
}
And SetPlayerCheckpoint has another parameter, it's the size of the checkpoint.
Reply
#3

and what to do in
pawn Код:
OnPlayerEnterCheckpoint
Reply
#4

Whatever you want, give cash to a player or weapons...or set a new checkpoint after entering the first one.
Reply
#5

Quote:
Originally Posted by Chasm
Посмотреть сообщение
Whatever you want, give cash to a player or weapons...or set a new checkpoint after entering the first one.
i'm asking about what is CP ID ?
pawn Код:
if(checkpointid == ??)
Reply
#6

OnPlayerEnterCheckpoint doesn't have a parameter called "checkpointid"...
Reply
#7

Oh, my mistake..
Reply
#8

Quote:
Originally Posted by dusk
Посмотреть сообщение
OnPlayerEnterCheckpoint doesn't have a parameter called "checkpointid"...
what if i have more than 1 CP ?? how to make each one do different thing ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)