Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
- #define FUEL_TRAILER 584
- #define COAL_TRAILER 450
- #define BOX_TRAILER 435
- enum MisLocationsEnum
- {
- ID,
- LoadName[128],
- Float:LoadX,
- Float:LoadY,
- Float:LoadZ,
- Float:UnloadX,
- Float:UnloadY,
- Float:UnloadZ,
- Pay,
- Trailer
- }
- new MisLocations[][MisLocationsEnum] =
- {
- {0, "Beer from Red County Brewery to Bone County Diner",-24.4073,-281.8898,5.9985,-305.4319,1315.6797,54.6189, 5980, FUEL_TRAILER},
- {1, "Fuel from LV Oil Refinery to LV Dirtring",266.8981,1416.5417,10.2001,1097.5164,1741.7422,10.5474, 5700, FUEL_TRAILER},
- {2, "Vehicle Parts from SF Airport ATC to Wang Cars",-1268.8223,13.6925,14.8682,-1986.3477,253.9728,35.8985, 3000, BOX_TRAILER},
- {3, "Fuel from SF Oil Refinery to RS Haul",-1016.3634,-688.2434,32.7284,-55.3397,-1138.2479,0.8052, 18770, FUEL_TRAILER}
- };
- #define TEAM_TRUCKER 1
- new iMissionText[512][MAX_PLAYERS], Float:unx[MAX_PLAYERS], Float:uny[MAX_PLAYERS], Float:unz[MAX_PLAYERS], iPay[MAX_PLAYERS], MissionStatus[MAX_PLAYERS], trailertype = 0;
- main(){}
- public OnGameModeInit()
- {
- AddPlayerClass(72, -2105.3228, -124.2982, 37.2531, 0.0, 0,0,0,0,0,0);//Trucker - SF
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- switch (classid)
- {
- case 0:
- {
- GameTextForPlayer(playerid, "Trucker", 3000, 4);
- SetPlayerTeam(playerid, TEAM_TRUCKER);
- }
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(work, 4, cmdtext);
- dcmd(stopwork, 8, cmdtext);
- return 0;
- }
- dcmd_work(playerid, params[])
- {
- #pragma unused params
- if(GetPlayerTeam(playerid) == TEAM_TRUCKER) return T_NewJob(playerid);
- return 1;
- }
- dcmd_stopwork(playerid, params[])
- {
- #pragma unused params
- if(GetPlayerTeam(playerid) == TEAM_TRUCKER) return StopWork(playerid);
- return 1;
- }
- stock T_NewJob(playerid)
- {
- new MisRand = random(sizeof(MisLocations));
- new vID = GetPlayerVehicleID(playerid);
- if(GetVehicleModel(vID)== 403 || GetVehicleModel(vID)== 515 || GetVehicleModel(vID) == 514)
- {
- if (MisLocations[MisRand][Trailer] == BOX_TRAILER || MisLocations[MisRand][Trailer] == COAL_TRAILER || MisLocations[MisRand][Trailer] == FUEL_TRAILER)
- {
- if(IsTrailerAttachedToVehicle(vID))
- {
- MissionStatus[playerid] = 1;
- 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);
- trailertype = MisLocations[MisRand][Trailer];
- format(LoadText, 128, "%s",MisLocations[MisRand][LoadName]);
- SendClientMessage(playerid, -1, "Mission:");
- SendClientMessage(playerid, -1, LoadText);
- }
- else
- {
- SendClientMessage(playerid, -1, "You need a trailer!");
- }
- }
- else
- {
- SendClientMessage(playerid, -1, "You need a trailer...!");
- }
- }
- else
- {
- SendClientMessage(playerid, -1, "You must be in a Truck to perform this!");
- }
- return 1;
- }
- stock StopWork(playerid)
- {
- DisablePlayerCheckpoint(playerid);
- SendClientMessage(playerid, -1, "You chose to cancel the mission and got fined $100");
- GivePlayerMoney(playerid, -100);
- MissionStatus[playerid] = 0;
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- CheckpointEntered(playerid);
- return 1;
- }
- stock CheckpointEntered(playerid)
- {
- new gString[128];
- new vID = GetPlayerVehicleID(playerid);
- if(!IsTrailerAttachedToVehicle(vID)) return SendClientMessage(playerid, -1, "You need a trailer to unload!");
- if(MissionStatus[playerid] == 1)
- {
- DisablePlayerCheckpoint(playerid);
- SetPlayerCheckpoint(playerid, unx[playerid], uny[playerid], unz[playerid], 7);
- SendClientMessage(playerid, -1, "Loaded. Please head to the second checkpoint!");
- MissionStatus[playerid] = 2;
- }
- else if(MissionStatus[playerid] == 2)
- {
- DisablePlayerCheckpoint(playerid);
- GivePlayerMoney(playerid, iPay[playerid]);
- SendClientMessage(playerid, -1, "Well done! You completed the mission!");
- format(gString, 512, "%s has completed mission: %s", pName(playerid), iMissionText[playerid]);
- SendClientMessageToAll(-1, gString);
- SetPlayerScore(playerid, GetPlayerScore(playerid)+2);
- MissionStatus[playerid] = 0;
- }
- return 1;
- }
- stock pName(PN)
- {
- new PX[MAX_PLAYER_NAME];
- GetPlayerName(PN, PX, sizeof(PX));
- return PX;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement