Pilot Job [Help with my code]
#1

Ok so I've made a simple Pilot job which goes between San Fierro and Los Santos.

The one problem is when I reach the checkpoint at the other Airport it seems to start going in a loop. It will give me the message to prepare to go to san fierro airport and los santos airport and keep paying me the money. I'm not sure what I'm missing here.

PILOT JOB CODE

pawn Код:
//// PLANE TIMER WHEN AT CHECKPOINT

forward PlaneWait(playerid);
public PlaneWait(playerid)
{
    new planepilot;
    planepilot = GetPlayerVehicleID(playerid);
    if(PlaneStep[playerid] == 1 && SFPlane[playerid] == 1)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, SFAIRX,SFAIRY,SFAIRZ, 15.0);
        PlaneStep[playerid] = 2;
        SendClientMessage(playerid,COLOR_ORANGE,"Once your passengers have finished exiting/entering the plane");
        SendClientMessage(playerid,COLOR_ORANGE,"please prepare for take off and head to San Fierro Airport");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(PlaneID[i] == planepilot)
            {
                SendClientMessage(i,COLOR_ORANGE,"[PILOT]: We have landed at Los Santos Airport");
                SendClientMessage(i,COLOR_ORANGE,"[PILOT]: Our next stop will be San Fierro Airport");
                return 1;
            }
        }
    }
    if(PlaneStep[playerid] == 2 && SFPlane[playerid] == 1)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, LSAIRX,LSAIRY,LSAIRZ, 15.0);
        PlaneStep[playerid] = 1;
        SendClientMessage(playerid,COLOR_ORANGE,"Once your passengers have finished exiting/entering the plane");
        SendClientMessage(playerid,COLOR_ORANGE,"please prepare for take off and head to Los Santos Airport");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(PlaneID[i] == planepilot)
            {
                SendClientMessage(i,COLOR_ORANGE,"[PILOT]: We have landed at San Fierro Airport");
                SendClientMessage(i,COLOR_ORANGE,"[PILOT]: Our next stop will be Los Santos Airport");
                return 1;
            }
        }
    }
    if(PlaneStep[playerid] == 1 && LSPlane[playerid] == 1)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, LSAIRX,LSAIRY,LSAIRZ, 15.0);
        PlaneStep[playerid] = 2;
        SendClientMessage(playerid,COLOR_ORANGE,"Once your passengers have finished exiting/entering the plane");
        SendClientMessage(playerid,COLOR_ORANGE,"please prepare for take off and head to Los Santos Airport");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(PlaneID[i] == planepilot)
            {
                SendClientMessage(i,COLOR_ORANGE,"[PILOT]: We have landed at San Fierro Airport");
                SendClientMessage(i,COLOR_ORANGE,"[PILOT]: Our next stop will be Los Santos Airport");
                return 1;
            }
        }
    }
    if(PlaneStep[playerid] == 2 && LSPlane[playerid] == 1)
    {
        TogglePlayerControllable(playerid, 1);
        SetPlayerCheckpoint(playerid, SFAIRX,SFAIRY,SFAIRZ, 15.0);
        PlaneStep[playerid] = 1;
        SendClientMessage(playerid,COLOR_ORANGE,"Once your passengers have finished exiting/entering the plane");
        SendClientMessage(playerid,COLOR_ORANGE,"please prepare for take off and head to San Fierro Airport");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(PlaneID[i] == planepilot)
            {
                SendClientMessage(i,COLOR_ORANGE,"[PILOT]: We have landed at Los Santos Airport");
                SendClientMessage(i,COLOR_ORANGE,"[PILOT]: Our next stop will be San Fierro Airport");
                return 1;
            }
        }
    }
    return 1;
}




//// PLANE ENTERS CHECKPOINT

    if(PilotJob[playerid] == 1)
    {
        GameTextForPlayer(playerid, "~w~Please wait....", 5000, 4);
        GivePlayerCash(playerid, 1500);
        DisablePlayerCheckpoint(playerid);
        SetTimerEx("PlaneWait", 5000, 0, "d", playerid);
        TogglePlayerControllable(playerid, 0);
        return 1;
    }
   
   
   
///// COMMAND TO ACTIVATE THE JOB

        if(strcmp("/sfpilot", cmd, true) == 0)
        {
            if(GetVehicleModel(vehicleid) == 592)
            {
                if(PilotJob[playerid] == 0)
                {
                    PlaneStep[playerid] = 1;
                    PilotJob[playerid] = 1;
                    SFPlane[playerid] = 1;
                    SendClientMessage(playerid,COLOR_ORANGE,"You decided to take the sidejob earning $1500!");
                    SendClientMessage(playerid,COLOR_ORANGE,"Please prepare for take off and head to Los Santos Airport!");
                    SendClientMessage(playerid,COLOR_WHITE,"Please /scan your ID card! (( /scan ))");
                    SetPlayerCheckpoint(playerid, LSAIRX,LSAIRY,LSAIRZ, 15.0);
                    return 1;
                }
                else
                {
                    DisablePlayerCheckpoint(playerid);
                    PilotJob[playerid] = 0;
                    SFPlane[playerid] = 0;
                    SendClientMessage(playerid,COLOR_RED,"You decided to stop the sidejob.");
                    return 1;
                }
            }
        }
        if(strcmp("/lspilot", cmd, true) == 0)
        {
            if(GetVehicleModel(vehicleid) == 592)
            {
                if(PilotJob[playerid] == 0)
                {
                    PlaneStep[playerid] = 1;
                    PilotJob[playerid] = 1;
                    LSPlane[playerid] = 1;
                    SendClientMessage(playerid,COLOR_ORANGE,"You decided to take the sidejob earning $1500!");
                    SendClientMessage(playerid,COLOR_ORANGE,"Please prepare for take off and head to San Fierro Airport!");
                    SendClientMessage(playerid,COLOR_WHITE,"Please /scan your ID card! (( /scan ))");
                    SetPlayerCheckpoint(playerid, SFAIRX,SFAIRY,SFAIRZ, 15.0);
                    return 1;
                }
                else
                {
                    DisablePlayerCheckpoint(playerid);
                    PilotJob[playerid] = 0;
                    LSPlane[playerid] = 0;
                    SendClientMessage(playerid,COLOR_RED,"You decided to stop the sidejob.");
                    return 1;
                }
            }
        }
       
       
////// ENTERING THE PLANE


        if(GetVehicleModel(vehicleid) == 592)
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "---------------------------------------------");
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can earn $1500 from this sidejob for being a pilot");
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "If you would like to start this sidejob type /sfpilot or /lspilot");
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "(( Type /sfpilot if you are in San Fierro Airport ))");
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "(( Type /lspilot if you are in Los Santos Airport ))");
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "---------------------------------------------");
            TogglePlayerControllable(playerid, 0);
        }
Reply
#2

[SOLVED]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)