Dynamic checkpoints not working properly.
#3

Thanks for the response. Will try to apply the checkpoints for specific playerids and change the random value.

EDIT: I've modified a lot of the job and the only issue left is when you deliver to the delivery checkpoint. For some reason the message "format(string,sizeof(string), "You have earned %d$ for your packages. Deliver the truck back to the depot to collect your pay.", tJob[playerid][tTempPayment]);" appears when delivering to the deliver checkpoint.

pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    if(checkpointid == cp_truckerjob[playerid])
    {
        new string[128];
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
            if(IsTrailerAttachedToVehicle(TruckerJobVehicle[i]))
            {
                if(IsPlayerInVehicle(playerid, TruckerJobVehicle[i]))
                {
                    DestroyDynamicCP(cp_truckerjob[playerid]);
                    tJob[playerid][tTempPayment] = tJob[playerid][tLoadAmount] *2;
                    format(string,sizeof(string), "You have earned %d$ for your packages. Deliver the truck back to the depot to collect your pay.", tJob[playerid][tTempPayment]);
                    SCM(playerid,COLOR_GREEN, string);
                    TIMER_TDELIVERY[playerid] = SetTimerEx("tDeliveryTimer", 4000, false, "i", playerid);
                    break;
                }
                if(i == MAX_VEHICLES - 1)
                {
                    SCM(pid,COLOR_GREY, "[ERROR]: You're not in a Semi Truck.");
                }
            }
            if(i == MAX_VEHICLES - 1)
            {
                SCM(pid,COLOR_GREY, "[ERROR]: You need a trailer attached to a semi truck.");
            }
        }
    }
    if(checkpointid == cp_tdelivery[playerid])
    {
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
            if(IsTrailerAttachedToVehicle(TruckerJobVehicle[i]))
            {
                if(IsPlayerInVehicle(playerid, TruckerJobVehicle[i]))
                {
                    DestroyDynamicCP(cp_tdelivery[playerid]);
                    KillTimer(TIMER_TDELIVERY[playerid]);
                    SCM(playerid,COLOR_GREEN, "Payment collected.");
                    GivePlayerMoney(playerid, tJob[playerid][tTempPayment]);
                    tJob[playerid][tTempPayment] = 0;
                    tJob[playerid][tLoaded] = 0;
                    tJob[playerid][tLoadAmount] = 0;
                    break;
                }
                if(i == MAX_VEHICLES - 1)
                {
                    SCM(pid,COLOR_GREY, "[ERROR]: You need to be in your semi truck to complete the delivery.");
                }
            }
            if(i == MAX_VEHICLES - 1)
            {
                SCM(pid,COLOR_GREY, "[ERROR]: You need a trailer attached to complete the delivery. (/quitjob if stuck.)");
            }
        }
    }
}
Reply


Messages In This Thread
Dynamic checkpoints not working properly. - by rangerxxll - 01.06.2014, 03:59
Re: Dynamic checkpoints not working properly. - by RajatPawar - 01.06.2014, 04:05
Re: Dynamic checkpoints not working properly. - by rangerxxll - 01.06.2014, 04:07

Forum Jump:


Users browsing this thread: 1 Guest(s)