10.10.2012, 11:23
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
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;
}