Guest User

Untitled

a guest
Jan 6th, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.71 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.  
  77. SetTimer("CheckpointEntered", 300, 0);
  78. return 1;
  79. }
  80.  
  81. main(){}
  82.  
  83. public OnPlayerRequestClass(playerid, classid)
  84. {
  85. switch (classid)
  86. {
  87. case 0:
  88. {
  89. GameTextForPlayer(playerid, "Trucker", 3000, 4);
  90. SetPlayerTeam(playerid, TEAM_TRUCKER);
  91. }
  92. }
  93. return 1;
  94. }
  95.  
  96. public OnPlayerSpawn(playerid)
  97. {
  98. if(GetPlayerTeam(playerid) == TEAM_TRUCKER)
  99. {
  100. SetPlayerColor(playerid, COLOR_GREEN);
  101. }
  102. return 1;
  103. }
  104.  
  105. COMMAND:work(playerid, params[])
  106. {
  107. if(GetPlayerTeam(playerid) == TEAM_TRUCKER)
  108. {
  109. new vID = GetPlayerVehicleID(playerid);
  110. if(GetVehicleModel(vID)== 403 || GetVehicleModel(vID)== 515 || GetVehicleModel(vID) == 514)
  111. {
  112. return Trucker_Trailer(playerid);
  113. }
  114. else if(GetVehicleModel(vID)== 455 || GetVehicleModel(vID)== 456 || GetVehicleModel(vID) == 578)
  115. {
  116. return Trucker_NoTrailer(playerid);
  117. }
  118. else SendClientMessage(playerid, COLOR_RED, "You need a truck!");
  119. }
  120. return 1;
  121. }
  122.  
  123. COMMAND:stopwork(playerid, params[])
  124. {
  125. if(GetPlayerTeam(playerid) == TEAM_TRUCKER)
  126. {
  127. return StopWork(playerid);
  128. }
  129. return 1;
  130. }
  131.  
  132. COMMAND:truck(playerid, params[])
  133. {
  134. new Float:pos[4];
  135. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  136. GetPlayerFacingAngle(playerid, pos[3]);
  137. new vehicle = CreateVehicle(515, pos[0], pos[1], pos[2], pos[3], 1, 1, 1200);
  138. PutPlayerInVehicle(playerid, vehicle, 0);
  139. return 1;
  140. }
  141.  
  142. COMMAND:trailer1(playerid, params[])
  143. {
  144. new Float:pos[4];
  145. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  146. GetPlayerFacingAngle(playerid, pos[3]);
  147. new vehicle = CreateVehicle(591, pos[0], pos[1], pos[2], pos[3], 1, 1, 1200);
  148. PutPlayerInVehicle(playerid, vehicle, 0);
  149. return 1;
  150. }
  151.  
  152. COMMAND:trailer2(playerid, params[])
  153. {
  154. new Float:pos[4];
  155. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  156. GetPlayerFacingAngle(playerid, pos[3]);
  157. new vehicle = CreateVehicle(584, pos[0], pos[1], pos[2], pos[3], 1, 1, 1200);
  158. PutPlayerInVehicle(playerid, vehicle, 0);
  159. return 1;
  160. }
  161.  
  162. COMMAND:notrailer(playerid, params[])
  163. {
  164. new Float:pos[4];
  165. GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  166. GetPlayerFacingAngle(playerid, pos[3]);
  167. new vehicle = CreateVehicle(578, pos[0], pos[1], pos[2], pos[3], 1, 1, 1200);
  168. PutPlayerInVehicle(playerid, vehicle, 0);
  169. return 1;
  170. }
  171.  
  172. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  173. {
  174. return 1;
  175. }
  176.  
  177. public OnPlayerExitVehicle(playerid, vehicleid)
  178. {
  179. return 1;
  180. }
  181.  
  182. stock Trucker_Trailer(playerid)
  183. {
  184. if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
  185. {
  186. if(GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(playerid))) == 591)
  187. {
  188. MissionStatus[playerid] = 1;
  189. new MisRand = random(sizeof(Trailer1));
  190. new LoadText[128], Float:x, Float:y, Float:z;
  191. x = Trailer1[MisRand][LoadX];
  192. y = Trailer1[MisRand][LoadY];
  193. z = Trailer1[MisRand][LoadZ];
  194. unx[playerid] = Trailer1[MisRand][UnloadX];
  195. uny[playerid] = Trailer1[MisRand][UnloadY];
  196. unz[playerid] = Trailer1[MisRand][UnloadZ];
  197. iPay[playerid] = Trailer1[MisRand][Pay];
  198. SetPlayerCheckpoint(playerid, x, y, z, 7);
  199. format(LoadText, 128, "%s", Trailer1[MisRand][LoadName]);
  200. SendClientMessage(playerid, COLOR_GREEN, "Mission:");
  201. SendClientMessage(playerid, 0xFFFFFFFF, LoadText);
  202. }
  203. else if(GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(playerid))) == 584)
  204. {
  205. MissionStatus[playerid] = 1;
  206. new MisRand = random(sizeof(Trailer2));
  207. new LoadText[128], Float:x, Float:y, Float:z;
  208. x = Trailer2[MisRand][LoadX];
  209. y = Trailer2[MisRand][LoadY];
  210. z = Trailer2[MisRand][LoadZ];
  211. unx[playerid] = Trailer2[MisRand][UnloadX];
  212. uny[playerid] = Trailer2[MisRand][UnloadY];
  213. unz[playerid] = Trailer2[MisRand][UnloadZ];
  214. iPay[playerid] = Trailer2[MisRand][Pay];
  215. SetPlayerCheckpoint(playerid, x, y, z, 7);
  216. format(LoadText, 128, "%s",Trailer2[MisRand][LoadName]);
  217. SendClientMessage(playerid, COLOR_GREEN, "Mission:");
  218. SendClientMessage(playerid, 0xFFFFFFFF, LoadText);
  219. }
  220. }
  221. else
  222. {
  223. SendClientMessage(playerid, COLOR_RED, "You need a trailer!");
  224. }
  225. return 1;
  226. }
  227.  
  228. stock Trucker_NoTrailer(playerid)
  229. {
  230. MissionStatus[playerid] = 1;
  231. new MisRand = random(sizeof(NoTrailer));
  232. new LoadText[128], Float:x, Float:y, Float:z;
  233. x = NoTrailer[MisRand][LoadX];
  234. y = NoTrailer[MisRand][LoadY];
  235. z = NoTrailer[MisRand][LoadZ];
  236. unx[playerid] = NoTrailer[MisRand][UnloadX];
  237. uny[playerid] = NoTrailer[MisRand][UnloadY];
  238. unz[playerid] = NoTrailer[MisRand][UnloadZ];
  239. iPay[playerid] = NoTrailer[MisRand][Pay];
  240. SetPlayerCheckpoint(playerid, x, y, z, 7);
  241. format(LoadText, 128, "%s",NoTrailer[MisRand][LoadName]);
  242. SendClientMessage(playerid, COLOR_GREEN, "Mission:");
  243. SendClientMessage(playerid, 0xFFFFFFFF, LoadText);
  244. return 1;
  245. }
  246.  
  247. stock StopWork(playerid)
  248. {
  249. DisablePlayerCheckpoint(playerid);
  250. SendClientMessage(playerid, COLOR_RED, "You chose to cancel the mission and got fined $100");
  251. GivePlayerMoney(playerid, -100);
  252. MissionStatus[playerid] = 0;
  253. return 1;
  254. }
  255.  
  256. public OnPlayerEnterCheckpoint(playerid)
  257. {
  258. CheckpointEntered(playerid);
  259. return 1;
  260. }
  261.  
  262. stock CheckpointEntered(playerid)
  263. {
  264. new gString[128];
  265. new vID = GetPlayerVehicleID(playerid);
  266.  
  267. if(GetVehicleModel(vID)== 403 || GetVehicleModel(vID)== 515 || GetVehicleModel(vID) == 514)
  268. {
  269. if(!IsTrailerAttachedToVehicle(vID)) return SendClientMessage(playerid, COLOR_RED, "You need a trailer to unload!");
  270. }
  271. else if(GetVehicleModel(vID)== 455 || GetVehicleModel(vID)== 456 || GetVehicleModel(vID) == 578)
  272. {
  273. if(MissionStatus[playerid] == 1)
  274. {
  275. DisablePlayerCheckpoint(playerid);
  276. SetPlayerCheckpoint(playerid, unx[playerid], uny[playerid], unz[playerid], 7);
  277. SendClientMessage(playerid, COLOR_GREEN, "Loaded. Please head to the second checkpoint!");
  278. MissionStatus[playerid] = 2;
  279. }
  280. else if(MissionStatus[playerid] == 2)
  281. {
  282. DisablePlayerCheckpoint(playerid);
  283. GivePlayerMoney(playerid, iPay[playerid]);
  284. SendClientMessage(playerid, COLOR_GREEN, "Well done! You completed the mission!");
  285. format(gString, 512, "%s has completed mission: %s", pName(playerid), iMissionText[playerid]);
  286. SendClientMessageToAll(COLOR_GREEN, gString);
  287. SetPlayerScore(playerid, GetPlayerScore(playerid)+2);
  288. MissionStatus[playerid] = 0;
  289. }
  290. }
  291. return 1;
  292. }
  293.  
  294. stock pName(PN)
  295. {
  296. new PX[MAX_PLAYER_NAME];
  297. GetPlayerName(PN, PX, sizeof(PX));
  298. return PX;
  299. }
Advertisement
Add Comment
Please, Sign In to add comment