The problem is simple, you're calling all of the if statements in a row, so it's all happening instantly. This is what I mean:
Player enters checkpoint 1, cps2 is created, check is run again straight away for cps2, and will go through. This will continue all the way down to the last checkpoint.
How can you fix it? Like so:
pawn Код:
public OnPlayerEnterStreamedCheckpoint(playerid, streamid)
{
if(streamid == cps1)
{
cps2 = CreateCheckpoint(playerid, 1558.6582,-1025.8751,23.9063, 2, 500);
DisablePlayerCheckpoint(playerid);
}
else if(streamid == cps2)
{
cps3 = CreateCheckpoint(playerid, 1572.4071,-1017.6917,23.9140, 2, 500);
DisablePlayerCheckpoint(playerid);
}
else if(streamid == cps3)
{
cps4 = CreateCheckpoint(playerid, 1578.5472,-1024.1747,23.9063, 2, 500);
DisablePlayerCheckpoint(playerid);
}
else if(streamid == cps4)
{
cps5 = CreateCheckpoint(playerid, 1584.9760,-1018.5584,23.9063, 2, 500);
DisablePlayerCheckpoint(playerid);
}
else if(streamid == cps5)
{
cps6 = CreateCheckpoint(playerid, 1592.5760,-1024.9053,23.9063, 2, 500);
DisablePlayerCheckpoint(playerid);
}
return 1;
}
Note: You should also have DisablePlayerCheckpoint before creating a new one.