garbagesystem.pwn 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Garbage Job System
  11. Next Generation Gaming, LLC
  12. (created by Next Generation Gaming Development Team)
  13. * Copyright (c) 2014, Next Generation Gaming, LLC
  14. *
  15. * All rights reserved.
  16. *
  17. * Redistribution and use in source and binary forms, with or without modification,
  18. * are not permitted in any case.
  19. *
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  25. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  26. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  27. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  28. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  29. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  30. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. */
  33. // WINTERFIELD: VERSION .278 GARBAGE JOB
  34. #include <YSI\y_hooks>
  35. hook OnGameModeInit() {
  36. GarbageVehicles[0] = AddStaticVehicleEx(408,2450.0818,-2117.0393,14.0948,359.3405,-1,-1,300); // Garbage 1
  37. GarbageVehicles[1] = AddStaticVehicleEx(408,2456.0059,-2117.0317,14.0978,359.8398,-1,-1,300); // Garbage 2
  38. GarbageVehicles[2] = AddStaticVehicleEx(408,2461.9404,-2116.9187,14.1033,1.3363,-1,-1,300); // Garbage 3
  39. GarbageVehicles[3] = AddStaticVehicleEx(408,2467.7634,-2116.7227,14.1018,0.6403,-1,-1,300); // Garbage 4
  40. GarbageVehicles[4] = AddStaticVehicleEx(408,2474.4385,-2116.6218,14.0943,2.2394,-1,-1,300); // Garbage 5
  41. GarbageVehicles[5] = AddStaticVehicleEx(408,2480.3513,-2116.6707,14.0944,359.6030,-1,-1,300); // Garbage 6
  42. GarbageVehicles[6] = AddStaticVehicleEx(408,2485.4556,-2116.5200,14.0988,1.4351,-1,-1,300); // Garbage 7
  43. GarbageVehicles[7] = AddStaticVehicleEx(408,2491.1963,-2116.4548,14.0918,0.3940,-1,-1,300); // Garbage 8
  44. }
  45. hook OnPlayerEnterCheckpoint(playerid)
  46. {
  47. if(GetPVarInt(playerid, "pGarbageRun") >= 1)
  48. {
  49. if(IsInGarbageTruck(GetPlayerVehicleID(playerid)))
  50. {
  51. if(GetPVarInt(playerid, "pGarbageStage") <= 4)
  52. {
  53. TogglePlayerControllable(playerid, false);
  54. GameTextForPlayer(playerid, "~W~LOADING...", 5000, 4);
  55. SetTimerEx("GarbageJobLoad", 4000, false, "i", playerid);
  56. }
  57. else if(GetPVarInt(playerid, "pGarbageStage") >= 5)
  58. {
  59. new value = 10000+random(10000);
  60. SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  61. DeletePVar(playerid, "pGarbageRun");
  62. DeletePVar(playerid, "pGarbageStage");
  63. DisablePlayerCheckpoint(playerid);
  64. GivePlayerCash(playerid, value);
  65. format(szMiscArray, sizeof(szMiscArray), "You have completed your garbage run and earned $%s.", number_format(value));
  66. SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  67. if(PlayerInfo[playerid][pDoubleEXP] > 0)
  68. {
  69. format(szMiscArray, sizeof(szMiscArray), "You have gained 2 garbage skill points instead of 1. You have %d hours left on the Double EXP token.", PlayerInfo[playerid][pDoubleEXP]);
  70. SendClientMessageEx(playerid, COLOR_YELLOW, szMiscArray);
  71. PlayerInfo[playerid][pGarbageSkill] += 2;
  72. }
  73. else
  74. {
  75. PlayerInfo[playerid][pGarbageSkill] += 1;
  76. }
  77. }
  78. return 1;
  79. }
  80. else SendClientMessageEx(playerid, COLOR_GRAD1, " You are not in a garbage truck!");
  81. }
  82. return 1;
  83. }
  84. command(garbagerun, playerid, params[])
  85. {
  86. if(PlayerInfo[playerid][pJob] == 27 || PlayerInfo[playerid][pJob2] == 27 || PlayerInfo[playerid][pJob3] == 27)
  87. {
  88. if(IsInGarbageTruck(GetPlayerVehicleID(playerid)))
  89. {
  90. if(GetPVarInt(playerid, "pGarbageRun") <= 0)
  91. {
  92. if(CheckPointCheck(playerid)) cmd_killcheckpoint(playerid, params);
  93. SetPVarInt(playerid, "pGarbageRun", 1);
  94. DeletePVar(playerid, "pGarbageStage");
  95. SetPVarInt(playerid, "pGarbagePath", random(5));
  96. SendClientMessageEx(playerid, COLOR_YELLOW, "You have started a garbage run, make your way to your first destination.");
  97. AdvanceGarbageJob(playerid);
  98. }
  99. else return SendClientMessageEx(playerid, COLOR_GRAD1, " You are already on a garbage run!");
  100. }
  101. else return SendClientMessageEx(playerid, COLOR_GRAD1, " You are not in a garbage truck!");
  102. }
  103. else SendClientMessageEx(playerid, COLOR_GRAD1, " You are not a garbage man!");
  104. return 1;
  105. }
  106. AdvanceGarbageJob(playerid)
  107. {
  108. switch(GetPVarInt(playerid, "pGarbagePath"))
  109. {
  110. case 0:
  111. {
  112. switch(GetPVarInt(playerid, "pGarbageStage"))
  113. {
  114. case 0: SetPlayerCheckpoint(playerid, 1864.9694,-1868.8340,13.5393, 4.0);
  115. case 1: SetPlayerCheckpoint(playerid, 1339.1879,-1772.2593,13.5432, 4.0);
  116. case 2: SetPlayerCheckpoint(playerid, 1097.3889,-1315.5203,13.7031, 4.0);
  117. case 3: SetPlayerCheckpoint(playerid, 788.5202,-1616.8534,13.9347, 4.0);
  118. case 4: SetPlayerCheckpoint(playerid, 870.7766,-1339.1848,13.1193, 4.0);
  119. }
  120. }
  121. case 1:
  122. {
  123. switch(GetPVarInt(playerid, "pGarbageStage"))
  124. {
  125. case 0: SetPlayerCheckpoint(playerid, 2393.3289,-2011.2156,13.1266, 4.0);
  126. case 1: SetPlayerCheckpoint(playerid, 2226.3372,-1689.5676,13.5651, 4.0);
  127. case 2: SetPlayerCheckpoint(playerid, 2340.3894,-1314.6295,23.6431, 4.0);
  128. case 3: SetPlayerCheckpoint(playerid, 2567.5251,-1490.1581,23.5875, 4.0);
  129. case 4: SetPlayerCheckpoint(playerid, 2123.0171,-1724.6511,13.1059, 4.0);
  130. }
  131. }
  132. case 2:
  133. {
  134. switch(GetPVarInt(playerid, "pGarbageStage"))
  135. {
  136. case 0: SetPlayerCheckpoint(playerid, 365.6633,-2045.8699,7.2444, 4.0);
  137. case 1: SetPlayerCheckpoint(playerid, 1032.4659,-1873.3563,12.8004, 4.0);
  138. case 2: SetPlayerCheckpoint(playerid, 2223.6206,-2669.4250,13.1041, 4.0);
  139. case 3: SetPlayerCheckpoint(playerid, 2613.2957,-2385.6138,13.1910, 4.0);
  140. case 4: SetPlayerCheckpoint(playerid, 2197.1860,-1975.7141,13.1308, 4.0);
  141. }
  142. }
  143. case 3:
  144. {
  145. switch(GetPVarInt(playerid, "pGarbageStage"))
  146. {
  147. case 0: SetPlayerCheckpoint(playerid, 1122.9072,-1567.9572,12.9752, 4.0);
  148. case 1: SetPlayerCheckpoint(playerid, 1363.5902,-1489.5615,13.1180, 4.0);
  149. case 2: SetPlayerCheckpoint(playerid, 1212.3572,-1128.1580,23.6371, 4.0);
  150. case 3: SetPlayerCheckpoint(playerid, 1138.6549,-864.0754,42.8240, 4.0);
  151. case 4: SetPlayerCheckpoint(playerid, 694.8854,-1184.0023,15.0451, 4.0);
  152. }
  153. }
  154. case 4:
  155. {
  156. switch(GetPVarInt(playerid, "pGarbageStage"))
  157. {
  158. case 0: SetPlayerCheckpoint(playerid, 1217.1318,-874.5201,42.4655, 4.0);
  159. case 1: SetPlayerCheckpoint(playerid, 1904.5316,-1776.6147,13.1084, 4.0);
  160. case 2: SetPlayerCheckpoint(playerid, 2127.1011,-1795.1913,13.1227, 4.0);
  161. case 3: SetPlayerCheckpoint(playerid, 2381.8950,-1937.8840,13.1190, 4.0);
  162. case 4: SetPlayerCheckpoint(playerid, 2392.3760,-1476.8688,23.3760, 4.0);
  163. }
  164. }
  165. case 5:
  166. {
  167. switch(GetPVarInt(playerid, "pGarbageStage"))
  168. {
  169. case 0: SetPlayerCheckpoint(playerid, 2231.9036,-1415.6742,23.3977, 4.0);
  170. case 1: SetPlayerCheckpoint(playerid, 2084.4321,-1261.1422,23.5523, 4.0);
  171. case 2: SetPlayerCheckpoint(playerid, 2094.3391,-1074.8816,25.9005, 4.0);
  172. case 3: SetPlayerCheckpoint(playerid, 2598.8777,-1060.4468,69.1403, 4.0);
  173. case 4: SetPlayerCheckpoint(playerid, 2743.9485,-1944.5190,13.1191, 4.0);
  174. }
  175. }
  176. case 6:
  177. {
  178. switch(GetPVarInt(playerid, "pGarbageStage"))
  179. {
  180. case 0: SetPlayerCheckpoint(playerid, 2194.4458,-1978.2390,13.1250, 4.0);
  181. case 1: SetPlayerCheckpoint(playerid, 1933.0288,-2036.1970,13.1260, 4.0);
  182. case 2: SetPlayerCheckpoint(playerid, 1501.1422,-1864.9788,13.1113, 4.0);
  183. case 3: SetPlayerCheckpoint(playerid, 1338.9059,-1843.0479,13.1106, 4.0);
  184. case 4: SetPlayerCheckpoint(playerid, 1420.6254,-1350.9736,13.1186, 4.0);
  185. }
  186. }
  187. case 7:
  188. {
  189. switch(GetPVarInt(playerid, "pGarbageStage"))
  190. {
  191. case 0: SetPlayerCheckpoint(playerid, 1017.2939,-1344.6605,12.9403, 4.0);
  192. case 1: SetPlayerCheckpoint(playerid, 827.6715,-1056.1721,24.8689, 4.0);
  193. case 2: SetPlayerCheckpoint(playerid, 1427.1379,-1047.8226,23.1440, 4.0);
  194. case 3: SetPlayerCheckpoint(playerid, 2216.7776,-1373.0634,23.5690, 4.0);
  195. case 4: SetPlayerCheckpoint(playerid, 2168.1399,-1650.5302,14.6085, 4.0);
  196. }
  197. }
  198. case 8:
  199. {
  200. switch(GetPVarInt(playerid, "pGarbageStage"))
  201. {
  202. case 0: SetPlayerCheckpoint(playerid, 2198.2585,-1499.0953,23.5222, 4.0);
  203. case 1: SetPlayerCheckpoint(playerid, 2366.4785,-1270.1448,23.3978, 4.0);
  204. case 2: SetPlayerCheckpoint(playerid, 2367.8533,-1760.7986,13.1166, 4.0);
  205. case 3: SetPlayerCheckpoint(playerid, 2821.5671,-1541.5742,10.4837, 4.0);
  206. case 4: SetPlayerCheckpoint(playerid, 2314.0564,-2307.3513,13.1077, 4.0);
  207. }
  208. }
  209. }
  210. return 1;
  211. }
  212. forward GarbageJobLoad(playerid);
  213. public GarbageJobLoad(playerid)
  214. {
  215. SetPVarInt(playerid, "pGarbageStage", GetPVarInt(playerid, "pGarbageStage")+1);
  216. TogglePlayerControllable(playerid, true);
  217. if(GetPVarInt(playerid, "pGarbageStage") != 5)
  218. {
  219. AdvanceGarbageJob(playerid);
  220. SendClientMessageEx(playerid, COLOR_WHITE, "Garbage loaded, make your way to the next checkpoint.");
  221. }
  222. else
  223. {
  224. SetPlayerCheckpoint(playerid, 2520.4834,-2089.1470,13.5469, 4.0); // return to hq
  225. SendClientMessageEx(playerid, COLOR_WHITE, "Your garbage truck is full, make your way back to headquarters.");
  226. }
  227. return 1;
  228. }