Second Checkpoint does not remove itself and does not call the third one
#1

The problem I am experiencing is that when I enter the first checkpoint it works good but when I enter the second checkpoint it simply keeps refreshing itself and does not call the third one.

Here's the OnPlayerEnterDynamicCP.
pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    new Float: sX, Float: sY, Float: sZ;
    if(checkpointid == dmvcp1)
    {
        DestroyDynamicCP(dmvcp1);
        dmvcp2 = CreateDynamicCP(1606.9996, -2319.3191, -2.8516, 5, 0, 0, playerid, 2000);
        return 1;
    }
    if(checkpointid == dmvcp2)
    {
        DestroyDynamicCP(dmvcp2);
        dmvcp3 = CreateDynamicCP(1575.9720, -2296.1660, -2.9355, 5, 0, 0, playerid, 2000);
        return 1;
    }
    if(checkpointid == dmvcp3)
    {
        DestroyDynamicCP(dmvcp3);
        GivePlayerCash(playerid, -2500);
        GameTextForPlayer(playerid, "~g~ Passed!", 1500, 0);
        GetPlayerPos(playerid, sX, sY, sZ);
        SetPlayerPos(playerid, sX, sY, sZ+2);
        DestroyVehicle(dmvcar[0]);
        return 1;
    }
    return 0;
}
I've tried many things, I tried using SetPlayerCheckpoint and place them under OnPlayerEnterCheckpoint, and that had the same effect.
I've tried returning 1 at the end of OnPlayerEnterDynamicCP and that didn't really influence the case.
I first started off with leaving the returns out. (Under each if statement) and what that did was showing me everything Checkpoint 3 should show.

Checkpoints is my weakness, I always struggle with them.
Anyhow, help is much appreciated!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)