Setplayercheckpoint
#1

How do you set a new checkpoint upon entering a current one? I'm wanting to create a route with multiple checkpoints to get you from A to B basically.

Thanks in advance.
Reply
#2

You can use OnPlayerEnterCheckpoint and lots of bools. For example
[pawn]OnPlayerEnterCheckpoint(playerid)
{
if(check1[playerid] == true) return SetPlayerCheckpoint(playerid, ....), check1[playerid] = false;
}
Reply
#3

Alternatively, you can do something like this:
pawn Код:
new playerCheckpoint[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    playerCheckpoint[playerid] = 0;
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, range, x, y, z) && playerCheckpoint[playerid] == 1)
    {
        DisablePlayerCheckpoint(playerid);
        SetPlayerCheckpoint(playerid, x, y, z, size);
        playerCheckpoint = 2;
    }
    else if(IsPlayerInRangeOfPoint(playerid, range, x, y, z) && playerCheckpoint[playerid] == 2)
    {
        DisablePlayerCheckpoint(playerid);
        SetPlayerCheckpoint(playerid, x, y, z, size);
        playerCheckpoint = 3;
    }
    return 1;
}
Check if the player is really near the range of the checkpoint. Disable the player's current checkpoint upon entering just for assurance. Then set the new player checkpoint and also it's variable for the next validation.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)