Advertisement
Guest User

Untitled

a guest
May 7th, 2012
972
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.01 KB | None | 0 0
  1. #include <a_samp>
  2. #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
  3.  
  4. #define COLOR_ORANGE 0xFFA500FF
  5. #define COLOR_LIMEGREEN 0x32CD32FF
  6. #define COLOR_ROYALBLUE 0x4169E1FF
  7. #define COLOR_SALMON 0xFA8072FF
  8. #define COLOR_GREY 0xAFAFAFAA
  9. #define COLOR_GREEN 0x33AA33AA
  10. #define COLOR_RED 0xAA3333AA
  11. #define COLOR_YELLOW 0xFFFF00AA
  12. #define COLOR_WHITE 0xFFFFFFAA
  13. #define COLOR_BLUE 0x0000BBAA
  14. #define COLOR_LIGHTBLUE 0x33CCFFAA
  15. #define COLOR_RED 0xAA3333AA
  16.  
  17. enum MisLocationsEnum
  18. {
  19.     ID,
  20.     LoadName[128],
  21.     Float:LoadX,
  22.     Float:LoadY,
  23.     Float:LoadZ,
  24.     Float:UnloadX,
  25.     Float:UnloadY,
  26.     Float:UnloadZ,
  27.     Pay
  28. }
  29.  
  30. new MisLocations[][MisLocationsEnum] =
  31. {
  32.     {0, "Beer from Red County Brewery to Bone County Diner",-24.4073,-281.8898,5.9985,-305.4319,1315.6797,54.6189, 5980},
  33.     {1, "Fuel from LV Oil Refinery to LV Dirtring",266.8981,1416.5417,10.2001,1097.5164,1741.7422,10.5474, 5700},
  34.     {2, "Vehicle Parts from SF Airport ATC to Wang Cars",-1268.8223,13.6925,14.8682,-1986.3477,253.9728,35.8985, 3000},
  35.     {3, "Fuel from SF Oil Refinery to RS Haul",-1016.3634,-688.2434,32.7284,-55.3397,-1138.2479,0.8052, 18770}
  36. };
  37.  
  38. #define TEAM_TRUCKER 1
  39.  
  40. new iMissionText[512][MAX_PLAYERS], Float:unx[MAX_PLAYERS], Float:uny[MAX_PLAYERS], Float:unz[MAX_PLAYERS], iPay[MAX_PLAYERS], MissionStatus[MAX_PLAYERS];
  41.  
  42. main(){}
  43.  
  44. public OnGameModeInit()
  45. {
  46.     AddPlayerClass(72, -2105.3228, -124.2982, 37.2531, 0.0, 0,0,0,0,0,0);//Trucker - SF
  47.     return 1;
  48. }
  49.  
  50. public OnPlayerRequestClass(playerid, classid)
  51. {
  52.     switch (classid)
  53.     {
  54.         case 0:
  55.         {
  56.             GameTextForPlayer(playerid, "Trucker", 3000, 4);
  57.             SetPlayerTeam(playerid, TEAM_TRUCKER);
  58.         }
  59.     }
  60.     return 1;
  61. }
  62.  
  63. public OnPlayerSpawn(playerid)
  64. {
  65.     if(GetPlayerTeam(playerid) == TEAM_TRUCKER)
  66.     {
  67.         SetPlayerColor(playerid, COLOR_GREEN);
  68.     }
  69.     return 1;
  70. }
  71.  
  72. public OnPlayerCommandText(playerid, cmdtext[])
  73. {
  74.     dcmd(work, 4, cmdtext);
  75.     dcmd(stopwork, 8, cmdtext);
  76.     return 0;
  77. }
  78.  
  79. dcmd_work(playerid, params[])
  80. {
  81.     #pragma unused params
  82.     if(GetPlayerTeam(playerid) == TEAM_TRUCKER) return T_NewJob(playerid);
  83.     return 1;
  84. }
  85.  
  86. dcmd_stopwork(playerid, params[])
  87. {
  88.     #pragma unused params
  89.     if(GetPlayerTeam(playerid) == TEAM_TRUCKER) return StopWork(playerid);
  90.     return 1;
  91. }
  92.  
  93. stock T_NewJob(playerid)
  94. {
  95.     new vID = GetPlayerVehicleID(playerid);
  96.     if(GetVehicleModel(vID)== 403 || GetVehicleModel(vID)== 515 || GetVehicleModel(vID) == 514)
  97.     {
  98.         if(IsTrailerAttachedToVehicle(vID))
  99.         {
  100.             MissionStatus[playerid] = 1;
  101.             new MisRand = random(sizeof(MisLocations));
  102.             new LoadText[128], Float:x, Float:y, Float:z;
  103.             x = MisLocations[MisRand][LoadX];
  104.             y = MisLocations[MisRand][LoadY];
  105.             z = MisLocations[MisRand][LoadZ];
  106.             unx[playerid] = MisLocations[MisRand][UnloadX];
  107.             uny[playerid] = MisLocations[MisRand][UnloadY];
  108.             unz[playerid] = MisLocations[MisRand][UnloadZ];
  109.             iPay[playerid] = MisLocations[MisRand][Pay];
  110.             SetPlayerCheckpoint(playerid, x, y, z, 7);
  111.             format(LoadText, 128, "%s",MisLocations[MisRand][LoadName]);
  112.             SendClientMessage(playerid, COLOR_GREEN, "Mission:");
  113.             SendClientMessage(playerid, COLOR_GREEN, "_____________________");
  114.             SendClientMessage(playerid, COLOR_GREEN, "");
  115.             SendClientMessage(playerid, 0xFFFFFFFF, LoadText);
  116.             SendClientMessage(playerid, COLOR_GREEN, "_____________________");
  117.         }
  118.         else
  119.         {
  120.             SendClientMessage(playerid, COLOR_RED, "You need a trailer!");
  121.         }
  122.     }
  123.     else
  124.     {
  125.         SendClientMessage(playerid, COLOR_RED, "You must be in a Truck to perform this!");
  126.     }
  127.     return 1;
  128. }
  129.  
  130.  
  131. stock StopWork(playerid)
  132. {
  133.     DisablePlayerCheckpoint(playerid);
  134.     SendClientMessage(playerid, COLOR_RED, "You chose to cancel the mission and got fined $100");
  135.     GivePlayerMoney(playerid, -100);
  136.     MissionStatus[playerid] = 0;
  137.     return 1;
  138. }
  139.  
  140. public OnPlayerEnterCheckpoint(playerid)
  141. {
  142.     CheckpointEntered(playerid);
  143.     return 1;
  144. }
  145.  
  146. stock CheckpointEntered(playerid)
  147. {
  148.     new gString[128];
  149.     new vID = GetPlayerVehicleID(playerid);
  150.     if(!IsTrailerAttachedToVehicle(vID)) return SendClientMessage(playerid, COLOR_RED, "You need a trailer to unload!");
  151.     if(MissionStatus[playerid] == 1)
  152.     {
  153.         DisablePlayerCheckpoint(playerid);
  154.         SetPlayerCheckpoint(playerid, unx[playerid], uny[playerid], unz[playerid], 7);
  155.         SendClientMessage(playerid, COLOR_ORANGE, "Loaded. Please head to the second checkpoint!");
  156.         MissionStatus[playerid] = 2;
  157.     }
  158.     else if(MissionStatus[playerid] == 2)
  159.     {
  160.         DisablePlayerCheckpoint(playerid);
  161.         GivePlayerMoney(playerid, iPay[playerid]);
  162.         SendClientMessage(playerid, COLOR_GREEN, "Well done! You completed the mission!");
  163.         format(gString, 512, "%s has completed mission: %s", pName(playerid), iMissionText[playerid]);
  164.         SendClientMessageToAll(COLOR_GREEN, gString);
  165.         SetPlayerScore(playerid, GetPlayerScore(playerid)+2);
  166.         MissionStatus[playerid] = 0;
  167.     }
  168.     return 1;
  169. }
  170.  
  171. stock pName(PN)
  172. {
  173.     new PX[MAX_PLAYER_NAME];
  174.     GetPlayerName(PN, PX, sizeof(PX));
  175.     return PX;
  176. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement