Doesn't set new checkpoint or anything in timer
#1

Please help. It doesn't show the next checkpoint and allow my player to move after ten second timer, it does sometimes and other times it doesn't.

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicleid) == 408)
    {
        if(IsPlayerInRangeOfPoint(playerid, 3, -1861.7811, 613.8149, 35.6365))
        {
            if(CheckPoint[playerid] == 0)
            {
                CheckPoint[playerid] = 1;
                TogglePlayerControllable(playerid, 0);
                DisablePlayerCheckpoint(playerid);
                SetTimerEx("TrashWait", 10000, false, "d", playerid);
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 3, -1973.4575, 613.3494, 35.6462))
        {
            if(CheckPoint[playerid] == 1)
            {
                GameTextForPlayer(playerid, "~g~Loading trash..", 8000, 1);
                CheckPoint[playerid] = 2;
                TogglePlayerControllable(playerid, 0);
                DisablePlayerCheckpoint(playerid);
                SetTimerEx("TrashWait", 10000, false, "d", playerid);
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 3, -2273.0881, 533.4693, 35.5678))
        {
            if(CheckPoint[playerid] == 2)
            {
                GameTextForPlayer(playerid, "~g~Loading trash..", 8000, 1);
                CheckPoint[playerid] = 3;
                TogglePlayerControllable(playerid, 0);
                DisablePlayerCheckpoint(playerid);
                SetTimerEx("TrashWait", 10000, false, "d", playerid);
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 3, -2247.7695, 692.6274, 49.9186))
        {
            if(CheckPoint[playerid] == 3)
            {
                GameTextForPlayer(playerid, "~g~Loading trash..", 8000, 1);
                CheckPoint[playerid] = 4;
                TogglePlayerControllable(playerid, 0);
                DisablePlayerCheckpoint(playerid);
                SetTimerEx("TrashWait", 10000, false, "d", playerid);
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 3, -2215.7053, 726.3495, 49.8793))
        {
            if(CheckPoint[playerid] == 4)
            {
                GameTextForPlayer(playerid, "~g~Loading trash..", 8000, 1);
                CheckPoint[playerid] = 5;
                TogglePlayerControllable(playerid, 0);
                DisablePlayerCheckpoint(playerid);
                SetTimerEx("TrashWait", 10000, false, "d", playerid);
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 3, -2151.5535, 630.0616, 52.8614))
        {
            if(CheckPoint[playerid] == 5)
            {
                GameTextForPlayer(playerid, "~g~Loading trash..", 8000, 1);
                CheckPoint[playerid] = 6;
                TogglePlayerControllable(playerid, 0);
                DisablePlayerCheckpoint(playerid);
                SetTimerEx("TrashWait", 10000, false, "d", playerid);
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 3, -2048.3267, 558.6334, 35.6366))
        {
            if(CheckPoint[playerid] == 6)
            {
                GameTextForPlayer(playerid, "~g~Loading trash..", 8000, 1);
                CheckPoint[playerid] = 7;
                TogglePlayerControllable(playerid, 0);
                DisablePlayerCheckpoint(playerid);
                SetTimerEx("TrashWait", 10000, false, "d", playerid);
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 3, -1996.3921, 805.4092, 45.9249))
        {
            if(CheckPoint[playerid] == 7)
            {
                GameTextForPlayer(playerid, "~g~Loading trash..", 8000, 1);
                CheckPoint[playerid] = 8;
                TogglePlayerControllable(playerid, 0);
                DisablePlayerCheckpoint(playerid);
                SetTimerEx("TrashWait", 10000, false, "d", playerid);
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 3, -1876.6791, 833.5188, 35.6298))
        {
            if(CheckPoint[playerid] == 8)
            {
                GameTextForPlayer(playerid, "~g~Loading trash..", 8000, 1);
                CheckPoint[playerid] = 9;
                TogglePlayerControllable(playerid, 0);
                DisablePlayerCheckpoint(playerid);
                SetTimerEx("TrashWait", 10000, false, "d", playerid);
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 3, -1657.9119, 738.7441, 17.7636))
        {
            if(CheckPoint[playerid] == 9)
            {
                GameTextForPlayer(playerid, "~g~Loading trash..", 8000, 1);
                CheckPoint[playerid] = 10;
                TogglePlayerControllable(playerid, 0);
                DisablePlayerCheckpoint(playerid);
                SetTimerEx("TrashWait", 10000, false, "d", playerid);
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 3, -1783.9250, 673.4773, 35.7228))
        {
            if(CheckPoint[playerid] == 10)
            {
                GameTextForPlayer(playerid, "~g~Loading trash..", 8000, 1);
                CheckPoint[playerid] = 11;
                TogglePlayerControllable(playerid, 0);
                DisablePlayerCheckpoint(playerid);
                SetTimerEx("TrashWait", 10000, false, "d", playerid);
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 3, -1813.2872, 613.6645, 35.6433))
        {
            if(CheckPoint[playerid] == 11)
            {
                GameTextForPlayer(playerid, "~g~Loading trash..", 8000, 1);
                CheckPoint[playerid] = 12;
                TogglePlayerControllable(playerid, 0);
                DisablePlayerCheckpoint(playerid);
                SetTimerEx("TrashWait", 10000, false, "d", playerid);
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 3, -1848.7577, 572.2956, 35.7571))
        {
            if(CheckPoint[playerid] == 12)
            {
                GameTextForPlayer(playerid, "~g~Loading trash..", 8000, 1);
                CheckPoint[playerid] = 13;
                TogglePlayerControllable(playerid, 0);
                DisablePlayerCheckpoint(playerid);
                SetTimerEx("TrashWait", 10000, false, "d", playerid);
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 3, -1783.7195, 568.3134, 35.7128))
        {
            if(CheckPoint[playerid] == 13)
            {
                GameTextForPlayer(playerid, "~g~Loading trash..", 8000, 1);
                CheckPoint[playerid] = 0;
                TogglePlayerControllable(playerid, 0);
                DisablePlayerCheckpoint(playerid);
                SetTimerEx("TrashWait", 10000, false, "d", playerid);
            }
        }
    }
    return 1;
}
pawn Код:
public TrashWait(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 3, -1861.7811,613.8149,35.6365))
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1973.4575,613.3494,35.6462, 3.0);
    }
    if(IsPlayerInRangeOfPoint(playerid, 3, -1973.4575,613.3494,35.6462))
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -2273.0881,533.4693,35.5678, 3.0);
    }
    if(IsPlayerInRangeOfPoint(playerid, 3, -2273.0881,533.4693,35.5678))
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -2247.7695,692.6274,49.9186, 3.0);
    }
    if(IsPlayerInRangeOfPoint(playerid, 3, -2247.7695,692.6274,49.9186))
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -2215.7053,726.3495,49.8793, 3.0);
    }
    if(IsPlayerInRangeOfPoint(playerid, 3, -2215.7053,726.3495,49.8793))
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -2151.5535,630.0616,52.8614, 3.0);
    }
    if(IsPlayerInRangeOfPoint(playerid, 3, -2151.5535,630.0616,52.8614))
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -2048.3267,558.6334,35.6366, 3.0);
    }
    if(IsPlayerInRangeOfPoint(playerid, 3, -2048.3267,558.6334,35.6366))
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1996.3921,805.4092,45.9249, 3.0);
    }
    if(IsPlayerInRangeOfPoint(playerid, 3, -1996.3921,805.4092,45.9249))
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1876.6791,833.5188,35.6298, 3.0);
    }
    if(IsPlayerInRangeOfPoint(playerid, 3, -1876.6791,833.5188,35.6298))
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1657.9119,738.7441,17.7636, 3.0);
    }
    if(IsPlayerInRangeOfPoint(playerid, 3, -1657.9119,738.7441,17.7636))
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1783.9250,673.4773,35.7228, 3.0);
    }
    if(IsPlayerInRangeOfPoint(playerid, 3, -1783.9250,673.4773,35.7228))
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1813.2872,613.6645,35.6433, 3.0);
    }
    if(IsPlayerInRangeOfPoint(playerid, 3, -1813.2872,613.6645,35.6433))
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1848.7577,572.2956,35.7571, 3.0);
    }
    if(IsPlayerInRangeOfPoint(playerid, 3, -1848.7577,572.2956,35.7571))
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1783.7195,568.3134,35.7128, 3.0);
    }
    if(IsPlayerInRangeOfPoint(playerid, 3, -1783.7195,568.3134,35.7128))
    {
        TogglePlayerControllable(playerid, 1);
        DisablePlayerCheckpoint(playerid);
        PlayerInfo[playerid][pSideJob] = SideJobTime;
        TrashJob[playerid] = 0;
        SideJobTimer[playerid] = SetTimer("SideJobs", 60000, true);
        SendClientMessage(playerid, -1, "Route complete - You have earned $850!");
        GiveCash(playerid, 850);
    }
    return 1;
}
Thank you!
Reply
#2

I think this problem occurs because you are no longer in the range when it checks your range at your TrashWait function.

To fix this issue, you can change the TrashWait function to this:
Код:
public TrashWait(playerid)
{
    if(CheckPoint[playerid] == 0)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1973.4575,613.3494,35.6462, 3.0);
    }
    else if(CheckPoint[playerid] == 1)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -2273.0881,533.4693,35.5678, 3.0);
    }
    else if(CheckPoint[playerid] == 2)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -2247.7695,692.6274,49.9186, 3.0);
    }
    else if(CheckPoint[playerid] == 3)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -2215.7053,726.3495,49.8793, 3.0);
    }
    else if(CheckPoint[playerid] == 4)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -2151.5535,630.0616,52.8614, 3.0);
    }
    else if(CheckPoint[playerid] == 5)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -2048.3267,558.6334,35.6366, 3.0);
    }
    else if(CheckPoint[playerid] == 6)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1996.3921,805.4092,45.9249, 3.0);
    }
    else if(CheckPoint[playerid] == 7)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1876.6791,833.5188,35.6298, 3.0);
    }
    else if(CheckPoint[playerid] == 8)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1657.9119,738.7441,17.7636, 3.0);
    }
    else if(CheckPoint[playerid] == 9)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1783.9250,673.4773,35.7228, 3.0);
    }
    else if(CheckPoint[playerid] == 10)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1813.2872,613.6645,35.6433, 3.0);
    }
    else if(CheckPoint[playerid] == 11)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1848.7577,572.2956,35.7571, 3.0);
    }
    else if(CheckPoint[playerid] == 12)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1783.7195,568.3134,35.7128, 3.0);
    }
    else if(CheckPoint[playerid] == 13)
    {
        TogglePlayerControllable(playerid, 1);
        DisablePlayerCheckpoint(playerid);
        PlayerInfo[playerid][pSideJob] = SideJobTime;
        TrashJob[playerid] = 0;
        SideJobTimer[playerid] = SetTimer("SideJobs", 60000, true);
        SendClientMessage(playerid, -1, "Route complete - You have earned $850!");
        GiveCash(playerid, 850);
    }
    return 1;
}
Alternatively you can just enlarge the range it checks in the TrashWait function.
Reply
#3

Quote:
Originally Posted by Conradus
Посмотреть сообщение
I think this problem occurs because you are no longer in the range when it checks your range at your TrashWait function.

To fix this issue, you can change the TrashWait function to this:
Код:
public TrashWait(playerid)
{
    if(CheckPoint[playerid] == 0)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1973.4575,613.3494,35.6462, 3.0);
    }
    else if(CheckPoint[playerid] == 1)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -2273.0881,533.4693,35.5678, 3.0);
    }
    else if(CheckPoint[playerid] == 2)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -2247.7695,692.6274,49.9186, 3.0);
    }
    else if(CheckPoint[playerid] == 3)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -2215.7053,726.3495,49.8793, 3.0);
    }
    else if(CheckPoint[playerid] == 4)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -2151.5535,630.0616,52.8614, 3.0);
    }
    else if(CheckPoint[playerid] == 5)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -2048.3267,558.6334,35.6366, 3.0);
    }
    else if(CheckPoint[playerid] == 6)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1996.3921,805.4092,45.9249, 3.0);
    }
    else if(CheckPoint[playerid] == 7)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1876.6791,833.5188,35.6298, 3.0);
    }
    else if(CheckPoint[playerid] == 8)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1657.9119,738.7441,17.7636, 3.0);
    }
    else if(CheckPoint[playerid] == 9)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1783.9250,673.4773,35.7228, 3.0);
    }
    else if(CheckPoint[playerid] == 10)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1813.2872,613.6645,35.6433, 3.0);
    }
    else if(CheckPoint[playerid] == 11)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1848.7577,572.2956,35.7571, 3.0);
    }
    else if(CheckPoint[playerid] == 12)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, -1783.7195,568.3134,35.7128, 3.0);
    }
    else if(CheckPoint[playerid] == 13)
    {
        TogglePlayerControllable(playerid, 1);
        DisablePlayerCheckpoint(playerid);
        PlayerInfo[playerid][pSideJob] = SideJobTime;
        TrashJob[playerid] = 0;
        SideJobTimer[playerid] = SetTimer("SideJobs", 60000, true);
        SendClientMessage(playerid, -1, "Route complete - You have earned $850!");
        GiveCash(playerid, 850);
    }
    return 1;
}
Alternatively you can just enlarge the range it checks in the TrashWait function.
Thanks, had to spend a while with editing that in some ways but this helped. +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)