Let's use OnPlayerUpdate as an example, as it's called LOTS of times each second.
OnPlayerUpdate:
pawn Код:
public OnPlayerUpdate(playerid)
{
if( IsPlayerInRangeOfPoint( playerid, 40.0, 0.0, 0.0, 0.0 )) //40.0 is the range, and the 3x 0.0 is the coords
SetPlayerCheckpoint( playerid, 0.0, 0.0, 0.0, 1.5 )) //Again, 0.0 = coords, and 1.5 is the size if the cp (if you don't know that already)
else if( IsPlayerInRangeOfPoint( playerid, 40.0, 1.0, 1.0, 1.0 )) //other location
SetPlayerCheckpoint( playerid, 1.0, 1.0, 1.0, 1.5 )) //checkpoint
//continue if more checkpoints ...
return true;
}
Remember that the coords used in the IsPlayerInRangeOfPoint function
should be equal to the checkpoint's coords.
OnPlayerEnterCheckpoint:
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
if( IsPlayerInRangeOfPoint( playerid, 1.5, 0.0, 0.0, 0.0 )) //Range shouldn't be much more than the size of the checkpoint, but it doesn't matter too much. Just remember to keep it around the same as size
{
//Do stuff you want, when player enters checkpoint
}
else if( IsPlayerInRangeOfPoint( playerid, 1.5, 1.0, 1.0, 1.0 )) //other cp
{
//Do other stuff
}
return true;
}
That's how I do it.
But remember: If you're going to use
alot of checkpoints, I recommend using a streamer, as it's probably faster and better.