SA-MP Forums Archive
Checkpoint not working - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Checkpoint not working (/showthread.php?tid=324952)



Checkpoint not working - Gerira Gaijin - 11.03.2012

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.


Re: Checkpoint not working - eesh - 11.03.2012

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;
}



Re: Checkpoint not working - Gerira Gaijin - 11.03.2012

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);   
    }



Re: Checkpoint not working - eesh - 11.03.2012

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


Re: Checkpoint not working - Gerira Gaijin - 11.03.2012

Still, it should show on the minimap.


Re: Checkpoint not working - eesh - 11.03.2012

but does it send the message?

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



Re: Checkpoint not working - Gerira Gaijin - 11.03.2012

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