SA-MP Forums Archive
random checkpoints - 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)
+--- Thread: random checkpoints (/showthread.php?tid=473331)



random checkpoints - AnonScripter - 02.11.2013

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



Re: random checkpoints - dusk - 02.11.2013

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.


Re: random checkpoints - AnonScripter - 02.11.2013

and what to do in
pawn Код:
OnPlayerEnterCheckpoint



Re: random checkpoints - Chasm - 02.11.2013

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


Re: random checkpoints - AnonScripter - 02.11.2013

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 == ??)



Re: random checkpoints - dusk - 02.11.2013

OnPlayerEnterCheckpoint doesn't have a parameter called "checkpointid"...


Re: random checkpoints - Chasm - 02.11.2013

Oh, my mistake..


Re: random checkpoints - AnonScripter - 02.11.2013

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 ?