Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(!strcmp("/work", command, true))
- {
- if(GetPlayerTeam(playerid) != 2) return SendClientMessage(playerid, 0xff0000ff, "ERROR: You are not a trucker!");
- if(GetPlayerVehicleSeat(playerid) != 0) return SendClientMessage(playerid, 0xff0000ff, "ERROR: You are not driving a vehicle!"); //Check if the player is DRIVING a vehicle, prevents missions as passenger
- if(GetPVarInt(playerid, "IsWorking?") != 0) return SendClientMessage(playerid, 0xff0000ff, "ERROR: You are already working!");
- new vid = GetPlayerVehicleID(playerid), vmod = GetVehicleModel(vid), tid = GetVehicleTrailer(vid), tmod = GetVehicleModel(tid);
- switch(vmod)
- {
- case 403, 514, 515: //Is the player driving a Linerunner, Tanker or roadtrain?
- {
- if(tid == 0) return SendClientMessage(playerid, red, "ERROR: You need a trailer attached to do trucker missions!");
- switch(tmod)
- {
- case 435, 591: //Is a BOX trailer?
- {
- #if defined USE_DIALOGS
- new str[1024], count, strB[111];
- new rand = count;
- for(new i; i < sizeof(TruckingMissionRandomBox); i++) //Loop init; Loop Checking; Loop Update //Loop for adding missions to dialog string
- {
- if(GetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName]) == 0)
- {
- format(strB, sizeof(strB), "Internal_%d_Value", count);
- SetPVarInt(playerid, strB, i);
- count++;
- format(str, sizeof(str), "{ff9000}%d) {ffffff}%s\r\n", count, TruckingMissionRandomBox[rand][LoadName]);
- }
- SetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName], GetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName])+1);
- }
- ShowPlayerDialog(playerid, 13342, DIALOG_STYLE_LIST, "{0000ff}Choose load", str, "Ok", "Cancel");
- #else
- new id = MRandom(sizeof(TruckingMissionRandomBox));
- new strB[128];
- format(strB, sizeof(strB), "%s from %s to %s", TruckingMissionRandomBox[id][LoadName], TruckingMissionRandomBox[id][LoadPointName], TruckingMissionRandomBox[id][UnloadPointName]);
- SetPVarString(playerid, "OnMission", strB);
- CreatePlayerMission(playerid, TruckingMissionRandomBox[id][UseTrailerCheck], TruckingMissionRandomBox[id][MissionPay], TruckingMissionRandomBox[id][loadx],TruckingMissionRandomBox[id][loady], TruckingMissionRandomBox[id][loadz], TruckingMissionRandomBox[id][unloadx],TruckingMissionRandomBox[id][unloady], TruckingMissionRandomBox[id][unloadz]);
- SetPVarInt(playerid, "IsWorking?", 1); //Better than using an array with size MAX_PLAYERS
- SendClientMessage(playerid, 0x00FF00FF, TruckingMissionRandomBox[id][MissionName]);
- #endif
- return 1; //Stops processing the code
- }
- case 450: //Is a DUMPER trailer?
- {
- #if defined USE_DIALOGS
- new str[1024], count, strB[111];
- new rand = count;
- for(new i; i < sizeof(TruckingMissionRandomDumper); i++) //Loop init; Loop Checking; Loop Update //Loop for adding missions to dialog string
- {
- if(GetPVarInt(playerid, TruckingMissionRandomDumper[rand][LoadName]) == 0)
- {
- format(strB, sizeof(strB), "Internal_%d_Value", count);
- SetPVarInt(playerid, strB, i);
- count++;
- format(str, sizeof(str), "{ff9000}%d) {ffffff}%s\r\n", count, TruckingMissionRandomDumper[rand][LoadName]);
- }
- SetPVarInt(playerid, TruckingMissionRandomDumper[rand][LoadName], GetPVarInt(playerid, TruckingMissionRandomDumper[rand][LoadName])+1);
- }
- ShowPlayerDialog(playerid, 13343, DIALOG_STYLE_LIST, "{0000ff}Choose load", str, "Ok", "Cancel");
- #else
- new id = MRandom(sizeof(TruckingMissionRandomDumper));
- new strB[128];
- format(strB, sizeof(strB), "%s from %s to %s", TruckingMissionRandomDumper[id][LoadName], TruckingMissionRandomDumper[id][LoadPointName], TruckingMissionRandomDumper[id][UnloadPointName]);
- SetPVarString(playerid, "OnMission", strB);
- CreatePlayerMission(playerid, TruckingMissionRandomDumper[id][UseTrailerCheck], TruckingMissionRandomDumper[id][MissionPay], TruckingMissionRandomDumper[id][loadx],TruckingMissionRandomDumper[id][loady], TruckingMissionRandomDumper[id][loadz], TruckingMissionRandomDumper[id][unloadx],TruckingMissionRandomDumper[id][unloady], TruckingMissionRandomDumper[id][unloadz]);
- SetPVarInt(playerid, "IsWorking?", 1); //Better than using an array with size MAX_PLAYERS
- SendClientMessage(playerid, 0x00FF00FF, TruckingMissionRandomDumper[id][MissionName]);
- #endif
- return 1; //Stops processing the code
- }
- case 584: //Is a PETRO trailer?
- {
- #if defined USE_DIALOGS
- new str[1024], count, strB[111];
- new rand = count;
- for(new i; i < sizeof(TruckingMissionRandomPetro); i++) //Loop init; Loop Checking; Loop Update //Loop for adding missions to dialog string
- {
- if(GetPVarInt(playerid, TruckingMissionRandomPetro[rand][LoadName]) == 0)
- {
- format(strB, sizeof(strB), "Internal_%d_Value", count);
- SetPVarInt(playerid, strB, i);
- count++;
- format(str, sizeof(str), "{ff9000}%d) {ffffff}%s\r\n", count, TruckingMissionRandomPetro[rand][LoadName]);
- }
- SetPVarInt(playerid, TruckingMissionRandomPetro[rand][LoadName], GetPVarInt(playerid, TruckingMissionRandomPetro[rand][LoadName])+1);
- }
- ShowPlayerDialog(playerid, 13344, DIALOG_STYLE_LIST, "{0000ff}Choose load", str, "Ok", "Cancel");
- #else
- new id = MRandom(sizeof(TruckingMissionRandomPetro));
- new strB[128];
- format(strB, sizeof(strB), "%s from %s to %s", TruckingMissionRandomPetro[id][LoadName], TruckingMissionRandomPetro[id][LoadPointName], TruckingMissionRandomPetro[id][UnloadPointName]);
- SetPVarString(playerid, "OnMission", strB);
- CreatePlayerMission(playerid, TruckingMissionRandomPetro[id][UseTrailerCheck], TruckingMissionRandomPetro[id][MissionPay], TruckingMissionRandomPetro[id][loadx],TruckingMissionRandomPetro[id][loady], TruckingMissionRandomPetro[id][loadz], TruckingMissionRandomPetro[id][unloadx],TruckingMissionRandomPetro[id][unloady], TruckingMissionRandomPetro[id][unloadz]);
- SetPVarInt(playerid, "IsWorking?", 1); //Better than using an array with size MAX_PLAYERS
- SendClientMessage(playerid, 0x00FF00FF, TruckingMissionRandomPetro[id][MissionName]);
- #endif
- return 1; //Stops processing the
- }
- }
- return SendClientMessage(playerid, red, "ERROR: Invalid trailer"); //If no match was found in the 'switch' then the trailer type is invalid
- }
- case 578, 455, 498: //Is the player driving a DTF-30, Flatbed or Boxville?
- {
- #if defined USE_DIALOGS
- new str[1024], count, strB[111];
- new rand = count;
- for(new i; i < sizeof(TruckingMissionRandomBox); i++) //Loop init; Loop Checking; Loop Update //Loop for adding missions to dialog string
- {
- if(GetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName]) == 0)
- {
- format(strB, sizeof(strB), "Internal_%d_Value", count);
- SetPVarInt(playerid, strB, i);
- count++;
- format(str, sizeof(str), "{ff9000}%d) {ffffff}%s\r\n", count, TruckingMissionRandomBox[rand][LoadName]);
- }
- SetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName], GetPVarInt(playerid, TruckingMissionRandomBox[rand][LoadName])+1);
- }
- ShowPlayerDialog(playerid, 13342, DIALOG_STYLE_LIST, "{0000ff}Choose load", str, "Ok", "Cancel");
- #else
- new id = MRandom(sizeof(TruckingMissionRandomBox));
- new strB[128];
- format(strB, sizeof(strB), "%s from %s to %s", TruckingMissionRandomBox[id][LoadName], TruckingMissionRandomBox[id][LoadPointName], TruckingMissionRandomBox[id][UnloadPointName]);
- SetPVarString(playerid, "OnMission", strB);
- CreatePlayerMission(playerid, TruckingMissionRandomBox[id][UseTrailerCheck], TruckingMissionRandomBox[id][MissionPay], TruckingMissionRandomBox[id][loadx],TruckingMissionRandomBox[id][loady], TruckingMissionRandomBox[id][loadz], TruckingMissionRandomBox[id][unloadx],TruckingMissionRandomBox[id][unloady], TruckingMissionRandomBox[id][unloadz]);
- SetPVarInt(playerid, "IsWorking?", 1); //Better than using an array with size MAX_PLAYERS
- SendClientMessage(playerid, 0x00FF00FF, TruckingMissionRandomBox[id][MissionName]);
- #endif
- return 1; //Stops processing the code
- }
- }
- return SendClientMessage(playerid, red, "ERROR: You can't work with this vehicle"); //If no match was found in the 'switch' then the vehicle is invalid
- }
Advertisement
Add Comment
Please, Sign In to add comment