Guest User

Untitled

a guest
Jan 6th, 2014
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.27 KB | None | 0 0
  1. //--Includes--//
  2. #include <a_samp>
  3. #include <zcmd>
  4.  
  5. //--Defines--//
  6. #define TEAM_TRUCKER 1
  7.  
  8. //--Define Colors--//
  9. #define COLOR_GREEN 0x33AA33AA
  10. #define COLOR_RED 0xAA3333AA
  11.  
  12. enum Trailer1Enum
  13. {
  14. ID,
  15. LoadName[128],
  16. Float:LoadX,
  17. Float:LoadY,
  18. Float:LoadZ,
  19. Float:UnloadX,
  20. Float:UnloadY,
  21. Float:UnloadZ,
  22. Pay
  23. }
  24. enum Trailer2Enum
  25. {
  26. ID,
  27. LoadName[128],
  28. Float:LoadX,
  29. Float:LoadY,
  30. Float:LoadZ,
  31. Float:UnloadX,
  32. Float:UnloadY,
  33. Float:UnloadZ,
  34. Pay
  35. }
  36. enum NoTrailerEnum
  37. {
  38. ID,
  39. LoadName[128],
  40. Float:LoadX,
  41. Float:LoadY,
  42. Float:LoadZ,
  43. Float:UnloadX,
  44. Float:UnloadY,
  45. Float:UnloadZ,
  46. Pay
  47. }
  48.  
  49. new Trailer1[][Trailer1Enum] =
  50. {
  51. {0, "Beer from Red County Brewery to Bone County Diner Trailer1",-24.4073,-281.8898,5.9985,-305.4319,1315.6797,54.6189, 5980},
  52. {1, "Fuel from LV Oil Refinery to LV Dirtring Trailer1",266.8981,1416.5417,10.2001,1097.5164,1741.7422,10.5474, 5700},
  53. {2, "Vehicle Parts from SF Airport ATC to Wang Cars Trailer1",-1268.8223,13.6925,14.8682,-1986.3477,253.9728,35.8985, 3000},
  54. {3, "Fuel from SF Oil Refinery to RS Haul Trailer1",-1016.3634,-688.2434,32.7284,-55.3397,-1138.2479,0.8052, 18770}
  55. };
  56. new Trailer2[][Trailer2Enum] =
  57. {
  58. {0, "Beer from Red County Brewery to Bone County Diner Trailer2",-24.4073,-281.8898,5.9985,-305.4319,1315.6797,54.6189, 5980},
  59. {1, "Fuel from LV Oil Refinery to LV Dirtring Trailer2",266.8981,1416.5417,10.2001,1097.5164,1741.7422,10.5474, 5700},
  60. {2, "Vehicle Parts from SF Airport ATC to Wang Cars Trailer2",-1268.8223,13.6925,14.8682,-1986.3477,253.9728,35.8985, 3000},
  61. {3, "Fuel from SF Oil Refinery to RS Haul Trailer2",-1016.3634,-688.2434,32.7284,-55.3397,-1138.2479,0.8052, 18770}
  62. };
  63. new NoTrailer[][NoTrailerEnum] =
  64. {
  65. {0, "Beer from Red County Brewery to Bone County Diner NoTrailer",-24.4073,-281.8898,5.9985,-305.4319,1315.6797,54.6189, 5980},
  66. {1, "Fuel from LV Oil Refinery to LV Dirtring NoTrailer",266.8981,1416.5417,10.2001,1097.5164,1741.7422,10.5474, 5700},
  67. {2, "Vehicle Parts from SF Airport ATC to Wang Cars NoTrailer",-1268.8223,13.6925,14.8682,-1986.3477,253.9728,35.8985, 3000},
  68. {3, "Fuel from SF Oil Refinery to RS Haul NoTrailer",-1016.3634,-688.2434,32.7284,-55.3397,-1138.2479,0.8052, 18770}
  69. };
  70.  
  71. new iMissionText[512][MAX_PLAYERS], Float:unx[MAX_PLAYERS], Float:uny[MAX_PLAYERS], Float:unz[MAX_PLAYERS], iPay[MAX_PLAYERS], MissionStatus[MAX_PLAYERS];
  72.  
  73. public OnGameModeInit()
  74. {
  75. AddPlayerClass(72, -2105.3228, -124.2982, 37.2531, 0.0, 0,0,0,0,0,0);//Trucker - SF
  76. return 1;
  77. }
  78.  
  79. main(){}
  80.  
  81. public OnPlayerRequestClass(playerid, classid)
  82. {
  83. switch (classid)
  84. {
  85. case 0:
  86. {
  87. GameTextForPlayer(playerid, "Trucker", 3000, 4);
  88. SetPlayerTeam(playerid, TEAM_TRUCKER);
  89. }
  90. }
  91. return 1;
  92. }
  93.  
  94. public OnPlayerSpawn(playerid)
  95. {
  96. if(GetPlayerTeam(playerid) == TEAM_TRUCKER)
  97. {
  98. SetPlayerColor(playerid, COLOR_GREEN);
  99. }
  100. return 1;
  101. }
  102.  
  103. COMMAND:work(playerid, params[])
  104. {
  105. if(GetPlayerTeam(playerid) == TEAM_TRUCKER) return T_NewJob(playerid);
  106. return 1;
  107. }
  108.  
  109. COMMAND:stopwork(playerid, params[])
  110. {
  111. if(GetPlayerTeam(playerid) == TEAM_TRUCKER) return StopWork(playerid);
  112. return 1;
  113. }
  114.  
  115.  
  116. COMMAND:truck(playerid, params[])
  117. {
  118. new Float:pos[4];
  119. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  120. GetPlayerFacingAngle(playerid, pos[3]);
  121. new vehicle = CreateVehicle(515, pos[0], pos[1], pos[2], pos[3], 1, 1, 1200);
  122. PutPlayerInVehicle(playerid, vehicle, 0);
  123. return 1;
  124. }
  125.  
  126. COMMAND:trailer1(playerid, params[])
  127. {
  128. new Float:pos[4];
  129. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  130. GetPlayerFacingAngle(playerid, pos[3]);
  131. new vehicle = CreateVehicle(591, pos[0], pos[1], pos[2], pos[3], 1, 1, 1200);
  132. PutPlayerInVehicle(playerid, vehicle, 0);
  133. return 1;
  134. }
  135.  
  136. COMMAND:trailer2(playerid, params[])
  137. {
  138. new Float:pos[4];
  139. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  140. GetPlayerFacingAngle(playerid, pos[3]);
  141. new vehicle = CreateVehicle(584, pos[0], pos[1], pos[2], pos[3], 1, 1, 1200);
  142. PutPlayerInVehicle(playerid, vehicle, 0);
  143. return 1;
  144. }
  145.  
  146. COMMAND:notrailer(playerid, params[])
  147. {
  148. new Float:pos[4];
  149. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  150. GetPlayerFacingAngle(playerid, pos[3]);
  151. new vehicle = CreateVehicle(578, pos[0], pos[1], pos[2], pos[3], 1, 1, 1200);
  152. PutPlayerInVehicle(playerid, vehicle, 0);
  153. return 1;
  154. }
  155.  
  156. stock T_NewJob(playerid)
  157. {
  158. new vID = GetPlayerVehicleID(playerid);
  159. if(GetVehicleModel(vID)== 403 || GetVehicleModel(vID)== 515 || GetVehicleModel(vID) == 514)
  160. {
  161. if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
  162. {
  163. if(GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(playerid))) == 591)
  164. {
  165. MissionStatus[playerid] = 1;
  166. new MisRand = random(sizeof(Trailer1));
  167. new LoadText[128], Float:x, Float:y, Float:z;
  168. x = Trailer1[MisRand][LoadX];
  169. y = Trailer1[MisRand][LoadY];
  170. z = Trailer1[MisRand][LoadZ];
  171. unx[playerid] = Trailer1[MisRand][UnloadX];
  172. uny[playerid] = Trailer1[MisRand][UnloadY];
  173. unz[playerid] = Trailer1[MisRand][UnloadZ];
  174. iPay[playerid] = Trailer1[MisRand][Pay];
  175. SetPlayerCheckpoint(playerid, x, y, z, 7);
  176. format(LoadText, 128, "%s", Trailer1[MisRand][LoadName]);
  177. SendClientMessage(playerid, COLOR_GREEN, "Mission:");
  178. SendClientMessage(playerid, 0xFFFFFFFF, LoadText);
  179. }
  180. else if(GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(playerid))) == 584)
  181. {
  182. MissionStatus[playerid] = 1;
  183. new MisRand = random(sizeof(Trailer2));
  184. new LoadText[128], Float:x, Float:y, Float:z;
  185. x = Trailer2[MisRand][LoadX];
  186. y = Trailer2[MisRand][LoadY];
  187. z = Trailer2[MisRand][LoadZ];
  188. unx[playerid] = Trailer2[MisRand][UnloadX];
  189. uny[playerid] = Trailer2[MisRand][UnloadY];
  190. unz[playerid] = Trailer2[MisRand][UnloadZ];
  191. iPay[playerid] = Trailer2[MisRand][Pay];
  192. SetPlayerCheckpoint(playerid, x, y, z, 7);
  193. format(LoadText, 128, "%s",Trailer2[MisRand][LoadName]);
  194. SendClientMessage(playerid, COLOR_GREEN, "Mission:");
  195. SendClientMessage(playerid, 0xFFFFFFFF, LoadText);
  196. }
  197. }
  198. else if(GetVehicleModel(vID)== 455 || GetVehicleModel(vID)== 456 || GetVehicleModel(vID) == 578)
  199. {
  200. MissionStatus[playerid] = 1;
  201. new MisRand = random(sizeof(NoTrailer));
  202. new LoadText[128], Float:x, Float:y, Float:z;
  203. x = NoTrailer[MisRand][LoadX];
  204. y = NoTrailer[MisRand][LoadY];
  205. z = NoTrailer[MisRand][LoadZ];
  206. unx[playerid] = NoTrailer[MisRand][UnloadX];
  207. uny[playerid] = NoTrailer[MisRand][UnloadY];
  208. unz[playerid] = NoTrailer[MisRand][UnloadZ];
  209. iPay[playerid] = NoTrailer[MisRand][Pay];
  210. SetPlayerCheckpoint(playerid, x, y, z, 7);
  211. format(LoadText, 128, "%s",NoTrailer[MisRand][LoadName]);
  212. SendClientMessage(playerid, COLOR_GREEN, "Mission:");
  213. SendClientMessage(playerid, 0xFFFFFFFF, LoadText);
  214. }
  215. else
  216. {
  217. SendClientMessage(playerid, COLOR_RED, "You need a trailer!");
  218. }
  219. }
  220. else
  221. {
  222. SendClientMessage(playerid, COLOR_RED, "You must be in a Truck to perform this!");
  223. }
  224. return 1;
  225. }
  226.  
  227. stock StopWork(playerid)
  228. {
  229. DisablePlayerCheckpoint(playerid);
  230. SendClientMessage(playerid, COLOR_RED, "You chose to cancel the mission and got fined $100");
  231. GivePlayerMoney(playerid, -100);
  232. MissionStatus[playerid] = 0;
  233. return 1;
  234. }
  235.  
  236. public OnPlayerEnterCheckpoint(playerid)
  237. {
  238. CheckpointEntered(playerid);
  239. return 1;
  240. }
  241.  
  242. stock CheckpointEntered(playerid)
  243. {
  244. new gString[128];
  245. new vID = GetPlayerVehicleID(playerid);
  246. if(!IsTrailerAttachedToVehicle(vID)) return SendClientMessage(playerid, COLOR_RED, "You need a trailer to unload!");
  247. if(MissionStatus[playerid] == 1)
  248. {
  249. DisablePlayerCheckpoint(playerid);
  250. SetPlayerCheckpoint(playerid, unx[playerid], uny[playerid], unz[playerid], 7);
  251. SendClientMessage(playerid, COLOR_GREEN, "Loaded. Please head to the second checkpoint!");
  252. MissionStatus[playerid] = 2;
  253. }
  254. else if(MissionStatus[playerid] == 2)
  255. {
  256. DisablePlayerCheckpoint(playerid);
  257. GivePlayerMoney(playerid, iPay[playerid]);
  258. SendClientMessage(playerid, COLOR_GREEN, "Well done! You completed the mission!");
  259. format(gString, 512, "%s has completed mission: %s", pName(playerid), iMissionText[playerid]);
  260. SendClientMessageToAll(COLOR_GREEN, gString);
  261. SetPlayerScore(playerid, GetPlayerScore(playerid)+2);
  262. MissionStatus[playerid] = 0;
  263. }
  264. return 1;
  265. }
  266.  
  267. stock pName(PN)
  268. {
  269. new PX[MAX_PLAYER_NAME];
  270. GetPlayerName(PN, PX, sizeof(PX));
  271. return PX;
  272. }
Advertisement
Add Comment
Please, Sign In to add comment