Guest User

Untitled

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