SA-MP Forums Archive
Checkpoint help - 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: Checkpoint help (/showthread.php?tid=73143)



Checkpoint help - aaronishello - 12.04.2009

How can I create a checkpoint after another? I mean like this:

On player Spawn I create this checkpoint:
SetPlayerCheckpoint(playerid, -1394.9558,2646.2864,55.8605,3);

public OnPlayerEnterCheckpoint(playerid)
{
DisablePlayerCheckpoint(playerid);
GameTextForPlayer(playerid, "~w~" Reached The First Location! ,3000,4);

But then when I enter how can I create A Checkpoint here:
-2240.6870,2351.4380,4.9785

Then when you enter that it say:
GameTextForPlayer(playerid, "~w~" Reached The Second Location! ,3000,4);

then when you enter it, thanks.


Re: Checkpoint help - brett7 - 12.04.2009

you need to use a checkpoint streamer


Re: Checkpoint help - Donny_k - 13.04.2009

If you mean like a race just have a variable which tells the CP what the next ID is and do a switch.

pawn Код:
//top of script
new
  gPlayerCP[ MAX_PLAYERS ];

//connect and disconnect
  gPlayerCP[ playerid ] = 0;
Now do like you do in OnPlayerSpawn but reset the CP:

pawn Код:
SetPlayerCheckpoint(playerid, -1394.9558,2646.2864,55.8605,3);
  gPlayerCP[ playerid ] = 0; //make sure we start from the start
Now in OnPlayerEnterCheckpoint use a switch to determine the current and next CP for the player:

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
  DisablePlayerCheckpoint(playerid);
  switch ( gPlayerCP[ playerid ] )
  {
    case 0 :
    {
      GameTextForPlayer(playerid, "~w~" Reached The First Location! ,3000,4);
      SetPlayerCheckpoint(playerid, -2240.6870,2351.4380,4.9785,3);
      gPlayerCP[ playerid ] ++; //it now equals 1 for the next case
    }
    case 1 :
      GameTextForPlayer(playerid, "~w~" Reached The Second Location! ,3000,4);
      SetPlayerCheckpoint(playerid, COORDS_HERE ,,,,,3);
      gPlayerCP[ playerid ] ++; //it now equals 2 for the next case
    }
    case 2 :
    //and so on
  }
//rest of callback