Modifying the Trucking Mission
#1

I just followed this tutorial

http://forum.sa-mp.com/showthread.ph...hlight=Mission

it work fine

however it is classic.

i want to modify it to more interesting.

Like, if you leave the truck during the work, you have 30 seconds to go back and get it.
or if you lose the trailer you have 30 seconds to get it back.

and how can i make the Truckers_Job available to other trucks like PPC_Trucking
cause i use the ppc_trucking's vehicle spawning.

code

pawn Код:
CMD:work(playerid, params[])
{
    if(gTeam[playerid] == TEAM_TRUCKERS) return Truckers_Job(playerid);
    return 1;
}

CMD:cancelwork(playerid, params[])
{
    if(gTeam[playerid] == TEAM_TRUCKERS) return StopWork(playerid);
    return 1;
}

public OnPlayerLoadGoods(playerid)
{
    KillTimer(LoadGoodsT[playerid]);
    SendClientMessage(playerid, COLOR_YELLOW, "Goods Loaded!, Head to the next checkpoint!");
    GameTextForPlayer(playerid, "~w~Loading the ~g~Goods...~n~~w~Please wait...", 4500, 3);
    MissionStatus[playerid] = 2;
    CheckpointEntered(playerid);
    return 1;
}

public OnPlayerLoadGoodsEx(playerid)
{
    new str[128];
    KillTimer(LoadGoodsT[playerid]);
    SendClientMessage(playerid, COLOR_YELLOW, "You finished delivering the goods, You receive $1000!");
    format(str, sizeof(str), "%s has completed mission delivering %s", GetName(playerid), iMissionText[playerid]);
    SendClientMessageToAll(COLOR_YELLOW, str);
    SetPlayerScore(playerid, GetPlayerScore(playerid) + 2);
    MissionStatus[playerid] = 0;
    return 1;
}

stock Truckers_Job(playerid)
{
    new vID = GetPlayerVehicleID(playerid); //gets called on the next line
    if(GetVehicleModel(vID)== 403 || GetVehicleModel(vID)== 515 || GetVehicleModel(vID) == 514)
    {
        if(IsTrailerAttachedToVehicle(vID))
        {
            MissionStatus[playerid] = 1;
            new MisRand = random(sizeof(MisLocations));
            new LoadText[128], Float:x, Float:y, Float:z;
            x = MisLocations[MisRand][LoadX];
            y = MisLocations[MisRand][LoadY];
            z = MisLocations[MisRand][LoadZ];
            unx[playerid] = MisLocations[MisRand][UnloadX];
            uny[playerid] = MisLocations[MisRand][UnloadY];
            unz[playerid] = MisLocations[MisRand][UnloadZ];
            iPay[playerid] = MisLocations[MisRand][Pay];
            SetPlayerCheckpoint(playerid, x, y, z, 7);
            format(LoadText, 128, "%s", MisLocations[MisRand][LoadName]);
            SendClientMessage(playerid, COLOR_LIME, "Mission:");
            SendClientMessage(playerid, -1, "_____________________");
            SendClientMessage(playerid, -1, " ");
            SendClientMessage(playerid, COLOR_YELLOW, LoadText);
            SendClientMessage(playerid, -1, "_____________________");
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You need a trailer first before working!");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You must be in a Truck to perform this!");
    }
    return 1;
}

stock StopWork(playerid)
{
    if(MissionStatus[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "You are not working!");
    DisablePlayerCheckpoint(playerid);
    SendClientMessage(playerid, COLOR_RED, "You got fined $1000, As the payment for the lose of the goods!");
    GameTextForPlayer(playerid, "~w~You got fined ~r~$1000~n~~w~As the payment for the lose of the goods", 5300, 3);
    GivePlayerMoney(playerid, -1000);
    MissionStatus[playerid] = 0;
    return 1;
}

stock CheckpointEntered(playerid)
{
    new vID = GetPlayerVehicleID(playerid);
    if(!IsTrailerAttachedToVehicle(vID)) return SendClientMessage(playerid, COLOR_RED, "You need a trailer to unload the goods!");
    if(MissionStatus[playerid] == 1)
    {
        DisablePlayerCheckpoint(playerid);
        SetPlayerCheckpoint(playerid, unx[playerid], uny[playerid], unz[playerid], 7);
        SendClientMessage(playerid, COLOR_ORANGE, "Loading the goods..");
        GameTextForPlayer(playerid, "~w~Loading the ~g~Goods...~n~~w~Please wait...", 3500, 3);
        LoadGoodsT[playerid] = SetTimerEx("OnPlayerLoadGoods", 3500, false, "d", playerid);
    }
    else if(MissionStatus[playerid] == 2)
    {
        DisablePlayerCheckpoint(playerid);
        GameTextForPlayer(playerid, "~w~Unloading the ~r~Goods...~n~~w~Please wait...", 3500, 3);
        LoadGoodsT[playerid] = SetTimerEx("OnPlayerLoadGoodsEx", 3500, false, "d", playerid);
    }
    return 1;
}
Reply


Messages In This Thread
Modifying the Trucking Mission - by JaKe Elite - 10.10.2012, 11:23
Re: Modifying the Trucking Mission - by TzAkS. - 10.10.2012, 11:31
Re: Modifying the Trucking Mission - by Riddick94 - 10.10.2012, 11:31
Re: Modifying the Trucking Mission - by JaKe Elite - 11.10.2012, 09:14
Re: Modifying the Trucking Mission - by Riddick94 - 11.10.2012, 10:19
Re: Modifying the Trucking Mission - by XtremeR - 11.10.2012, 10:37
Re: Modifying the Trucking Mission - by JaKe Elite - 11.10.2012, 11:02
Re: Modifying the Trucking Mission - by JaKe Elite - 11.10.2012, 11:46
Re: Modifying the Trucking Mission - by Riddick94 - 11.10.2012, 11:48
Re: Modifying the Trucking Mission - by JaKe Elite - 12.10.2012, 08:46

Forum Jump:


Users browsing this thread: 4 Guest(s)