Checkpoint help
#1

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

you need to use a checkpoint streamer
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)