Guest User

Untitled

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