Checkpoint not working
#1

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 5, -2105.5925,-2403.5745,31.3825)){
        if(pRouteStatus[playerid] == 1 && pRoute[playerid] == 1){
            pRouteStatus[playerid] = 2;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid, sbInfo[pFactoryID[playerid]][ENX],sbInfo[pFactoryID[playerid]][ENY],sbInfo[pFactoryID[playerid]][ENZ], 5.0);
            return SendClientMessage(playerid, COLOR_WHITE, "[FACTORY:] Head to the weapons factory unload point to deliver materials. Type /cancelmission to cancel the mission.");
        }
    }
    if(IsPlayerInRangeOfPoint(playerid, 5, 2306.9885,-5318.7769,2.0906)){
        if(pRouteStatus[playerid] == 1 && pRoute[playerid] == 2){
            pRouteStatus[playerid] = 2;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid, sbInfo[pFactoryID[playerid]][ENX],sbInfo[pFactoryID[playerid]][ENY],sbInfo[pFactoryID[playerid]][ENZ], 5.0);
            return SendClientMessage(playerid, COLOR_WHITE, "[FACTORY:] Head to the weapons factory unload point to deliver materials. Type /cancelmission to cancel the mission.");
        }
    }
    if(IsPlayerInRangeOfPoint(playerid, 5, sbInfo[pFactoryID[playerid]][ENX],sbInfo[pFactoryID[playerid]][ENY],sbInfo[pFactoryID[playerid]][ENZ])){
        if(pRouteStatus[playerid] == 2){
            pRouteStatus[playerid] = 0;
            sbInfo[pFactoryID[playerid]][WeaponParts] += pMaterials[playerid];

            new string[150]; format(string, 150, "[FACTORY:] %i materials delivered to the factory. Total materials: %i. Type /checkmats to check the materials amount.", pMaterials[playerid], sbInfo[pFactoryID[playerid]][WeaponParts]);
            pMaterials[playerid] = 0;
            pFactoryID[playerid] = -1;
            return SendClientMessage(playerid, COLOR_WHITE, string);
        }
    }
    return 1;
}
It's a mat-running route. When I enter the first checkpoint, it shows me the message to return to the factory and all, but the 2nd checkpoint is not showing. I used "print" to check the variables, and pFactoryID is 0, as it should be, and everything else is in place too. I just don't get it.
Reply
#2

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 5, -2105.5925,-2403.5745,31.3825)){
        if(pRouteStatus[playerid] == 1 && pRoute[playerid] == 1){
            pRoute[playerid] = 2;//here was the problem
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid, sbInfo[pFactoryID[playerid]][ENX],sbInfo[pFactoryID[playerid]][ENY],sbInfo[pFactoryID[playerid]][ENZ], 5.0);
            return SendClientMessage(playerid, COLOR_WHITE, "[FACTORY:] Head to the weapons factory unload point to deliver materials. Type /cancelmission to cancel the mission.");
        }
    }
    if(IsPlayerInRangeOfPoint(playerid, 5, 2306.9885,-5318.7769,2.0906)){
        if(pRouteStatus[playerid] == 1 && pRoute[playerid] == 2){
            pRouteStatus[playerid] = 2;
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid, sbInfo[pFactoryID[playerid]][ENX],sbInfo[pFactoryID[playerid]][ENY],sbInfo[pFactoryID[playerid]][ENZ], 5.0);
            return SendClientMessage(playerid, COLOR_WHITE, "[FACTORY:] Head to the weapons factory unload point to deliver materials. Type /cancelmission to cancel the mission.");
        }
    }
    if(IsPlayerInRangeOfPoint(playerid, 5, sbInfo[pFactoryID[playerid]][ENX],sbInfo[pFactoryID[playerid]][ENY],sbInfo[pFactoryID[playerid]][ENZ])){
        if(pRouteStatus[playerid] == 2){
            pRouteStatus[playerid] = 0;
            sbInfo[pFactoryID[playerid]][WeaponParts] += pMaterials[playerid];

            new string[150]; format(string, 150, "[FACTORY:] %i materials delivered to the factory. Total materials: %i. Type /checkmats to check the materials amount.", pMaterials[playerid], sbInfo[pFactoryID[playerid]][WeaponParts]);
            pMaterials[playerid] = 0;
            pFactoryID[playerid] = -1;
            return SendClientMessage(playerid, COLOR_WHITE, string);
        }
    }
    return 1;
}
Reply
#3

Nah, that's not it. I changed the code and it's still not working. I even tried creating it at 0, 0, 0 but nothing.

pawn Код:
if(pRouteStatus[playerid] == 1) // If the player is at loading point
    {
        DisablePlayerCheckpoint(playerid);
        pRouteStatus[playerid] = 2;
        new Float:X, Float:Y, Float:Z;
       
        X = sbInfo[pFactoryID[playerid]][ENX];
        Y = sbInfo[pFactoryID[playerid]][ENY];
        Z = sbInfo[pFactoryID[playerid]][ENZ];
       
        SetPlayerCheckpoint(playerid, 0, 0, 0, 5.0); // 0 0 0 is for test - not working either
        return SendClientMessage(playerid, COLOR_WHITE, "[FACTORY:] Head to the weapons factory unload point to deliver materials. Type /cancelmission to cancel the mission."); // This message shows
    }
   
    if(pRouteStatus[playerid] == 2) // If the player is at the weapons factory, at the unload point - haven't tested it because the checkpoint in the first part of the code never shows up.
    {
        DisablePlayerCheckpoint(playerid);
        pRouteStatus[playerid] = 0;
        sbInfo[pFactoryID[playerid]][WeaponParts] += pMaterials[playerid];
       
        new string[150]; format(string, 150, "[FACTORY:] %i materials delivered to the factory. Total materials: %i. Type /checkmats to check the materials amount.", pMaterials[playerid], sbInfo[pFactoryID[playerid]][WeaponParts]);
        pMaterials[playerid] = 0;
        pFactoryID[playerid] = -1;
        return SendClientMessage(playerid, COLOR_WHITE, string);   
    }
Reply
#4

Umm you should know 0,0,0 is a little under the land @BlueBerry. Try 0,0,5

EDIT: also in your first post, you never set pRoute to 2 in the first checkpoint so the second checkpoint wouldnt do anything
Reply
#5

Still, it should show on the minimap.
Reply
#6

but does it send the message?

use this
pawn Код:
SetPlayerCheckpoint(playerid,21.44715,59.99038,3.1171875,0);
Reply
#7

It sends the message, but there's no checkpoint anywhere.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)