shipment.pwn 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Shipment System
  11. Next Generation Gaming, LLC
  12. (created by Next Generation Gaming Development Team)
  13. * Copyright (c) 2016, 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. #include <YSI\y_hooks>
  34. forward HijackTruck(playerid);
  35. public HijackTruck(playerid)
  36. {
  37. new vehicleid = GetPlayerVehicleID(playerid);
  38. new business = TruckDeliveringTo[vehicleid];
  39. SetPVarInt(playerid, "LoadTruckTime", GetPVarInt(playerid, "LoadTruckTime")-1);
  40. new string[128];
  41. format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~%d seconds left", GetPVarInt(playerid, "LoadTruckTime"));
  42. GameTextForPlayer(playerid, string, 1100, 3);
  43. if(GetPVarInt(playerid, "LoadTruckTime") > 0) SetTimerEx("HijackTruck", 1000, 0, "d", playerid);
  44. if(GetPVarInt(playerid, "LoadTruckTime") <= 0)
  45. {
  46. DeletePVar(playerid, "IsFrozen");
  47. TogglePlayerControllable(playerid, 1);
  48. DeletePVar(playerid, "LoadTruckTime");
  49. if(!IsPlayerInVehicle(playerid, vehicleid))
  50. {
  51. TruckUsed[playerid] = INVALID_VEHICLE_ID;
  52. gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
  53. DisablePlayerCheckpoint(playerid);
  54. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* You failed to hijack the shipment.");
  55. return 1;
  56. }
  57. foreach(new i: Player)
  58. {
  59. if(TruckUsed[i] == vehicleid)
  60. {
  61. DeletePVar(i, "LoadTruckTime");
  62. TruckUsed[i] = INVALID_VEHICLE_ID;
  63. DisablePlayerCheckpoint(i);
  64. gPlayerCheckpointStatus[i] = CHECKPOINT_NONE;
  65. SendClientMessageEx(i, COLOR_WHITE, "Your shipment delivery has failed. Your shipment was Hijacked.");
  66. }
  67. }
  68. TruckUsed[playerid] = vehicleid;
  69. if(!IsABoat(vehicleid))
  70. {
  71. new route = TruckRoute[vehicleid];
  72. SetPVarInt(playerid, "TruckDeliver", TruckContents{vehicleid});
  73. switch(TruckContents{vehicleid}) {
  74. case 0: {
  75. if(business != INVALID_BUSINESS_ID)
  76. {
  77. format(string, sizeof(string), "You hijacked a shipment of %s", GetInventoryType(TruckDeliveringTo[vehicleid]));
  78. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  79. SetPlayerCheckpoint(playerid, Businesses[business][bSupplyPos][0], Businesses[business][bSupplyPos][1], Businesses[business][bSupplyPos][2], 10.0);
  80. }
  81. }
  82. case 1: {
  83. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"You hijacked a shipment of food & beverages.");
  84. SetPlayerCheckpoint(playerid, TruckerDropoffs[route][PosX], TruckerDropoffs[route][PosY], TruckerDropoffs[route][PosZ], 5);
  85. }
  86. case 2:
  87. {
  88. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"You hijacked a shipment of clothing.");
  89. SetPlayerCheckpoint(playerid, TruckerDropoffs[route][PosX], TruckerDropoffs[route][PosY], TruckerDropoffs[route][PosZ], 5);
  90. }
  91. case 3:
  92. {
  93. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"You hijacked a shipment of materials.");
  94. SetPlayerCheckpoint(playerid, TruckerDropoffs[route][PosX], TruckerDropoffs[route][PosY], TruckerDropoffs[route][PosZ], 5);
  95. }
  96. case 4:
  97. {
  98. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* You hijacked a shipment of stolen 24/7 items - watch out for law enforcement!");
  99. SetPlayerCheckpoint(playerid, TruckerDropoffs[route][PosX], TruckerDropoffs[route][PosY], TruckerDropoffs[route][PosZ], 5);
  100. }
  101. case 5:
  102. {
  103. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* You hijacked a shipment of weapons - watch out for law enforcement!");
  104. SetPlayerCheckpoint(playerid, TruckerDropoffs[route][PosX], TruckerDropoffs[route][PosY], TruckerDropoffs[route][PosZ], 5);
  105. }
  106. case 6:
  107. {
  108. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"You hijacked a shipment of drugs - watch out for law enforcement!");
  109. SetPlayerCheckpoint(playerid, TruckerDropoffs[route][PosX], TruckerDropoffs[route][PosY], TruckerDropoffs[route][PosZ], 5);
  110. }
  111. case 7:
  112. {
  113. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"You hijacked a shipment of illegal materials - watch out for law enforcement!");
  114. SetPlayerCheckpoint(playerid, TruckerDropoffs[route][PosX], TruckerDropoffs[route][PosY], TruckerDropoffs[route][PosZ], 5);
  115. }
  116. }
  117. SendClientMessageEx(playerid, COLOR_REALRED, "WARNING: Watch out for Truck hijackers, they can hijack your truck and get away with the goods.");
  118. }
  119. else
  120. {
  121. SetPVarInt(playerid, "TruckDeliver", TruckContents{vehicleid});
  122. new route = TruckRoute[vehicleid];
  123. switch(TruckContents{vehicleid}) {
  124. case 1: {
  125. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"You hijacked a shipment of food & beverages.");
  126. SetPlayerCheckpoint(playerid, BoatDropoffs[route][PosX], BoatDropoffs[route][PosY], BoatDropoffs[route][PosZ], 5);
  127. }
  128. case 2:
  129. {
  130. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"You hijacked a shipment of clothing.");
  131. SetPlayerCheckpoint(playerid, BoatDropoffs[route][PosX], BoatDropoffs[route][PosY], BoatDropoffs[route][PosZ], 5);
  132. }
  133. case 3:
  134. {
  135. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"You hijacked a shipment of materials.");
  136. SetPlayerCheckpoint(playerid, BoatDropoffs[route][PosX], BoatDropoffs[route][PosY], BoatDropoffs[route][PosZ], 5);
  137. }
  138. case 4:
  139. {
  140. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* You hijacked a shipment of stolen 24/7 items - watch out for law enforcement!");
  141. SetPlayerCheckpoint(playerid, BoatDropoffs[route][PosX], BoatDropoffs[route][PosY], BoatDropoffs[route][PosZ], 5);
  142. }
  143. case 5:
  144. {
  145. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* You hijacked a shipment of weapons - watch out for law enforcement!");
  146. SetPlayerCheckpoint(playerid, BoatDropoffs[route][PosX], BoatDropoffs[route][PosY], BoatDropoffs[route][PosZ], 5);
  147. }
  148. case 6:
  149. {
  150. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"You hijacked a shipment of drugs - watch out for law enforcement!");
  151. SetPlayerCheckpoint(playerid, BoatDropoffs[route][PosX], BoatDropoffs[route][PosY], BoatDropoffs[route][PosZ], 5);
  152. }
  153. case 7:
  154. {
  155. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"You hijacked a shipment of illegal materials - watch out for law enforcement!");
  156. SetPlayerCheckpoint(playerid, BoatDropoffs[route][PosX], BoatDropoffs[route][PosY], BoatDropoffs[route][PosZ], 5);
  157. }
  158. default: return SendClientMessageEx(playerid, COLOR_GRAD2, "This vehicle is not loaded with hijackable goods.");
  159. }
  160. SendClientMessageEx(playerid, COLOR_REALRED, "WARNING: Watch out for boat hijackers, they can hijack your boat and get away with the goods.");
  161. }
  162. SendClientMessageEx(playerid, COLOR_WHITE, "Deliver the goods to the specified location (see checkpoint on radar).");
  163. }
  164. return 1;
  165. }
  166. forward LoadTruckOld(playerid);
  167. public LoadTruckOld(playerid)
  168. {
  169. SetPVarInt(playerid, "LoadTruckTime", GetPVarInt(playerid, "LoadTruckTime")-1);
  170. new string[128];
  171. format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~%d seconds left", GetPVarInt(playerid, "LoadTruckTime"));
  172. GameTextForPlayer(playerid, string, 1100, 3);
  173. if(GetPVarInt(playerid, "LoadTruckTime") > 0) SetTimerEx("LoadTruckOld", 1000, 0, "d", playerid);
  174. if(GetPVarInt(playerid, "LoadTruckTime") <= 0)
  175. {
  176. DeletePVar(playerid, "LoadTruckTime");
  177. DeletePVar(playerid, "IsFrozen");
  178. TogglePlayerControllable(playerid, 1);
  179. new vehicleid = GetPlayerVehicleID(playerid);
  180. new truckdeliver = GetPVarInt(playerid, "TruckDeliver");
  181. TruckContents{vehicleid} = truckdeliver;
  182. TruckUsed[playerid] = vehicleid;
  183. if(!IsABoat(vehicleid))
  184. {
  185. new route = random(sizeof(TruckerDropoffs));
  186. TruckRoute[vehicleid] = route;
  187. // 1 = food and bev
  188. // 2 = clothing
  189. // 3 = legal mats
  190. // 4 = 24/7 items
  191. // 5 = weapons
  192. // 6 = illegal drugs
  193. // 7 = illegal materials
  194. if(truckdeliver == 1)
  195. {
  196. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Your Truck was filled with food & beverages.");
  197. SetPlayerCheckpoint(playerid, TruckerDropoffs[route][PosX], TruckerDropoffs[route][PosY], TruckerDropoffs[route][PosZ], 5);
  198. }
  199. else if(truckdeliver == 2)
  200. {
  201. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Your Truck was filled with clothing.");
  202. SetPlayerCheckpoint(playerid, TruckerDropoffs[route][PosX], TruckerDropoffs[route][PosY], TruckerDropoffs[route][PosZ], 5);
  203. }
  204. else if(truckdeliver == 3)
  205. {
  206. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Your Truck was filled with materials.");
  207. SetPlayerCheckpoint(playerid, TruckerDropoffs[route][PosX], TruckerDropoffs[route][PosY], TruckerDropoffs[route][PosZ], 5);
  208. }
  209. else if(truckdeliver == 4)
  210. {
  211. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Your Truck was filled with 24/7 items.");
  212. SetPlayerCheckpoint(playerid, TruckerDropoffs[route][PosX], TruckerDropoffs[route][PosY], TruckerDropoffs[route][PosZ], 5);
  213. }
  214. else if(truckdeliver == 5)
  215. {
  216. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Your Truck was filled with weapons.");
  217. SetPlayerCheckpoint(playerid, TruckerDropoffs[route][PosX], TruckerDropoffs[route][PosY], TruckerDropoffs[route][PosZ], 5);
  218. }
  219. else if(truckdeliver == 6)
  220. {
  221. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Your Truck was filled with drugs.");
  222. SetPlayerCheckpoint(playerid, TruckerDropoffs[route][PosX], TruckerDropoffs[route][PosY], TruckerDropoffs[route][PosZ], 5);
  223. }
  224. else if(truckdeliver == 7)
  225. {
  226. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Your Truck was filled with illegal materials.");
  227. SetPlayerCheckpoint(playerid, TruckerDropoffs[route][PosX], TruckerDropoffs[route][PosY], TruckerDropoffs[route][PosZ], 5);
  228. }
  229. SendClientMessageEx(playerid, COLOR_REALRED, "WARNING: Watch out for Truck hijackers, they can hijack your truck and get away with the goods.");
  230. }
  231. else
  232. {
  233. new route = random(sizeof(BoatDropoffs));
  234. TruckRoute[vehicleid] = route;
  235. if(truckdeliver == 1)
  236. {
  237. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Your Boat was filled with food & beverages.");
  238. SetPlayerCheckpoint(playerid, BoatDropoffs[route][PosX], BoatDropoffs[route][PosY], BoatDropoffs[route][PosZ], 5);
  239. }
  240. else if(truckdeliver == 2)
  241. {
  242. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Your Boat was filled with clothing.");
  243. SetPlayerCheckpoint(playerid, BoatDropoffs[route][PosX], BoatDropoffs[route][PosY], BoatDropoffs[route][PosZ], 5);
  244. }
  245. else if(truckdeliver == 3)
  246. {
  247. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Your Boat was filled with materials.");
  248. SetPlayerCheckpoint(playerid, BoatDropoffs[route][PosX], BoatDropoffs[route][PosY], BoatDropoffs[route][PosZ], 5);
  249. }
  250. else if(truckdeliver == 4)
  251. {
  252. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Your Boat was filled with 24/7 items.");
  253. SetPlayerCheckpoint(playerid, BoatDropoffs[route][PosX], BoatDropoffs[route][PosY], BoatDropoffs[route][PosZ], 5);
  254. }
  255. else if(truckdeliver == 5)
  256. {
  257. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Your Boat was filled with weapons.");
  258. SetPlayerCheckpoint(playerid, BoatDropoffs[route][PosX], BoatDropoffs[route][PosY], BoatDropoffs[route][PosZ], 5);
  259. }
  260. else if(truckdeliver == 6)
  261. {
  262. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Your Boat was filled with drugs.");
  263. SetPlayerCheckpoint(playerid, BoatDropoffs[route][PosX], BoatDropoffs[route][PosY], BoatDropoffs[route][PosZ], 5);
  264. }
  265. else if(truckdeliver == 7)
  266. {
  267. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* Your Boat was filled with illegal materials.");
  268. SetPlayerCheckpoint(playerid, BoatDropoffs[route][PosX], BoatDropoffs[route][PosY], BoatDropoffs[route][PosZ], 5);
  269. }
  270. SendClientMessageEx(playerid, COLOR_REALRED, "WARNING: Watch out for boat hijackers, they can hijack your boat and get away with the goods.");
  271. }
  272. if(truckdeliver >= 5)
  273. {
  274. SendClientMessageEx(playerid, COLOR_REALRED, "WARNING #2: You are transporting illegal goods so watch out for law enforcement.");
  275. }
  276. SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Deliver the goods to the specified location (see checkpoint on radar).");
  277. SetPVarInt(playerid, "tpTruckRunTimer", 30);
  278. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPTRUCKRUNTIMER);
  279. }
  280. return 1;
  281. }
  282. forward LoadTruck(playerid);
  283. public LoadTruck(playerid)
  284. {
  285. SetPVarInt(playerid, "LoadTruckTime", GetPVarInt(playerid, "LoadTruckTime")-1);
  286. new string[128];
  287. format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~%d seconds left", GetPVarInt(playerid, "LoadTruckTime"));
  288. GameTextForPlayer(playerid, string, 1100, 3);
  289. if(GetPVarInt(playerid, "LoadTruckTime") > 0) SetTimerEx("LoadTruck", 1000, 0, "d", playerid);
  290. if(GetPVarInt(playerid, "LoadTruckTime") <= 0)
  291. {
  292. DeletePVar(playerid, "LoadTruckTime");
  293. DeletePVar(playerid, "IsFrozen");
  294. TogglePlayerControllable(playerid, 1);
  295. new vehicleid = GetPlayerVehicleID(playerid);
  296. new business = TruckDeliveringTo[vehicleid];
  297. TruckUsed[playerid] = vehicleid;
  298. gPlayerCheckpointStatus[playerid] = CHECKPOINT_DELIVERY;
  299. format(string, sizeof(string), "* Your Truck was filled with %s", GetInventoryType(business));
  300. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  301. SetPlayerCheckpoint(playerid, Businesses[business][bSupplyPos][0], Businesses[business][bSupplyPos][1], Businesses[business][bSupplyPos][2], 10.0);
  302. SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Deliver the goods to the specified location (see checkpoint on radar).");
  303. SendClientMessageEx(playerid, COLOR_REALRED, "WARNING: Watch out for truck hijackers, they can hijack your truck and get away with the goods.");
  304. if (Businesses[business][bType] == BUSINESS_TYPE_GUNSHOP)
  305. {
  306. SendClientMessageEx(playerid, COLOR_REALRED, "WARNING #2: You are transporting illegal goods so watch out for law enforcement.");
  307. }
  308. else if (Businesses[business][bType] == BUSINESS_TYPE_GASSTATION)
  309. {
  310. new Float:x, Float:y, Float:z, Float:ang;
  311. SetVehiclePos(vehicleid, -1570.9833,96.7547,4.1442);
  312. SetVehicleZAngle(vehicleid, 136.18);
  313. GetPlayerPos(playerid, x, y, z);
  314. GetVehicleZAngle(vehicleid, ang);
  315. new iTrailer = CreateVehicle(584, x, y, z+1, ang, -1, -1, 1000);
  316. SetPVarInt(playerid, "Gas_TrailerID", iTrailer);
  317. SetTimerEx("AttachGasTrailer", 500, false, "ii", iTrailer, vehicleid);
  318. }
  319. /*else if (Businesses[business][bType] == BUSINESS_TYPE_NEWCARDEALERSHIP)
  320. {
  321. new iModel, iSlot;
  322. for (new i; i < MAX_BUSINESS_DEALERSHIP_VEHICLES; i++)
  323. {
  324. if (Businesses[business][DealershipVehOrder][i]) {
  325. iModel = Businesses[business][bModel][i];
  326. iSlot = i;
  327. }
  328. }
  329. new Float: fVehPos[4];
  330. GetVehiclePos(vehicleid, fVehPos[0], fVehPos[1], fVehPos[2]);
  331. GetVehicleZAngle(vehicleid, fVehPos[3]);
  332. new iDeliveredVeh = CreateVehicle(iModel, fVehPos[0], fVehPos[1], fVehPos[2] + 3, fVehPos[3], 1, 1, -1);
  333. SetVehicleZAngle(iDeliveredVeh, fVehPos[3]);
  334. vehicle_lock_doors(iDeliveredVeh);
  335. SetPVarInt(playerid, "CarryingVehicle", iDeliveredVeh);
  336. SetPVarInt(playerid, "CarryingSlot", iSlot);
  337. } */
  338. SetPVarInt(playerid, "tpTruckRunTimer", floatround(GetPlayerDistanceFromPoint(playerid, Businesses[business][bSupplyPos][0], Businesses[business][bSupplyPos][1], Businesses[business][bSupplyPos][2]) / 100));
  339. SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_TPTRUCKRUNTIMER);
  340. }
  341. return 1;
  342. }
  343. stock DisplayOrders(playerid)
  344. {
  345. new szDialog[2048];
  346. for (new i, j; i < MAX_BUSINESSES; i++)
  347. {
  348. if (Businesses[i][bOrderState] == 1)
  349. {
  350. if(Businesses[i][bType] > 0)
  351. {
  352. format(szDialog, sizeof(szDialog), "%s%s\t%s\n", szDialog, Businesses[i][bName], GetInventoryType(i));
  353. ListItemTrackId[playerid][j++] = i;
  354. }
  355. }
  356. }
  357. if (!szDialog[0] || IsABoat(GetPlayerVehicleID(playerid)))
  358. {
  359. /*ShowPlayerDialogEx(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Error", "No jobs available right now. Try again later.", "OK", "");
  360. TogglePlayerControllable(playerid, 1);
  361. DeletePVar(playerid, "IsFrozen"); */
  362. if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 456 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 414 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 413 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 440 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 482 || IsABoat(GetPlayerVehicleID(playerid)))
  363. {
  364. ShowPlayerDialogEx(playerid,DIALOG_LOADTRUCKOLD,DIALOG_STYLE_LIST,"What do you want to transport?","{00F70C}Legal goods {FFFFFF}(no risk but also no bonuses)\n{FF0606}Illegal goods {FFFFFF}(risk of getting caught but a bonus)","Select","Cancel");
  365. }
  366. else
  367. {
  368. ShowPlayerDialogEx(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Error", "No jobs available for this type of truck right now. Try again later.", "OK", "");
  369. TogglePlayerControllable(playerid, 1);
  370. DeletePVar(playerid, "IsFrozen");
  371. }
  372. }
  373. else
  374. {
  375. ShowPlayerDialogEx(playerid, DIALOG_LOADTRUCK, DIALOG_STYLE_LIST, "Available Orders", szDialog, "Take", "Close");
  376. }
  377. return 1;
  378. }
  379. IsAtTruckDeliveryPoint(playerid)
  380. {
  381. for(new i = 0; i < sizeof(TruckerDropoffs); i++)
  382. {
  383. if(IsPlayerInRangeOfPoint(playerid, 6, TruckerDropoffs[i][PosX], TruckerDropoffs[i][PosY], TruckerDropoffs[i][PosZ])) {
  384. return 1;
  385. }
  386. }
  387. for(new i = 0; i < sizeof(BoatDropoffs); i++)
  388. {
  389. if(IsPlayerInRangeOfPoint(playerid, 6, BoatDropoffs[i][PosX], BoatDropoffs[i][PosY], BoatDropoffs[i][PosZ])) {
  390. return 1;
  391. }
  392. }
  393. return false;
  394. }
  395. CancelTruckDelivery(playerid)
  396. {
  397. new vehicleid = GetPlayerVehicleID(playerid);
  398. if(TruckDeliveringTo[TruckUsed[playerid]] != INVALID_BUSINESS_ID)
  399. {
  400. if(Businesses[TruckDeliveringTo[TruckUsed[playerid]]][bType] == BUSINESS_TYPE_GASSTATION)
  401. {
  402. DestroyVehicle(GetPVarInt(playerid, "Gas_TrailerID"));
  403. DeletePVar(playerid, "Gas_TrailerID");
  404. }
  405. Businesses[TruckDeliveringTo[TruckUsed[playerid]]][bOrderState] = 1;
  406. SaveBusiness(TruckDeliveringTo[TruckUsed[playerid]]);
  407. }
  408. if(1 <= TruckUsed[playerid] <= MAX_VEHICLES){
  409. TruckDeliveringTo[TruckUsed[playerid]] = INVALID_BUSINESS_ID, TruckContents{TruckUsed[playerid]} = 0;
  410. }
  411. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  412. {
  413. if(IsATruckerCar(vehicleid)) SetVehicleToRespawn(vehicleid);
  414. }
  415. gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
  416. TruckUsed[playerid] = INVALID_VEHICLE_ID;
  417. DisablePlayerCheckpoint(playerid);
  418. DeletePVar(playerid, "TruckDeliver");
  419. return 1;
  420. }
  421. CMD:checkcargo(playerid, params[])
  422. {
  423. if(PlayerInfo[playerid][pJob] != 20 && PlayerInfo[playerid][pJob2] != 20 && PlayerInfo[playerid][pJob3] != 20 && !IsACop(playerid))
  424. {
  425. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not a Shipment Contractor or a Cop!");
  426. return 1;
  427. }
  428. new carid = GetPlayerVehicleID(playerid);
  429. new closestcar = GetClosestCar(playerid, carid);
  430. if(IsPlayerInRangeOfVehicle(playerid, closestcar, 6.0) && IsATruckerCar(closestcar))
  431. {
  432. if(IsPlayerInAnyVehicle(playerid))
  433. {
  434. SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot search the contents of this vehicle while inside a vehicle.");
  435. return 1;
  436. }
  437. new engine,lights,alarm,doors,bonnet,boot,objective;
  438. GetVehicleParamsEx(closestcar,engine,lights,alarm,doors,bonnet,boot,objective);
  439. if(boot == VEHICLE_PARAMS_OFF || boot == VEHICLE_PARAMS_UNSET)
  440. {
  441. SendClientMessageEx(playerid, COLOR_GRAD1, "The vehicle's trunk must be opened in order to search it.");
  442. return 1;
  443. }
  444. new string[128];
  445. SendClientMessageEx(playerid, COLOR_GREEN,"_______________ SHIPMENT CONTRACTOR LOAD SHEET _______________");
  446. if(IsPlayerInVehicle(playerid, closestcar))
  447. {
  448. SendClientMessageEx(playerid, COLOR_WHITE, "There is a person in that truck. In order to check the content of the truck, the driver must be removed.");
  449. return 1;
  450. }
  451. new iTruckContents = TruckContents{closestcar};
  452. new truckcontentname[50];
  453. if(iTruckContents == 1)
  454. { format(truckcontentname, sizeof(truckcontentname), "{00F70C}Food & beverages");}
  455. else if(iTruckContents == 2)
  456. { format(truckcontentname, sizeof(truckcontentname), "{00F70C}Clothing"); }
  457. else if(iTruckContents == 3)
  458. { format(truckcontentname, sizeof(truckcontentname), "{00F70C}Legal materials"); }
  459. else if(iTruckContents == 4)
  460. { format(truckcontentname, sizeof(truckcontentname), "{00F70C}24/7 items"); }
  461. else if(iTruckContents == 5)
  462. { format(truckcontentname, sizeof(truckcontentname), "{FF0606}Illegal weapons"); }
  463. else if(iTruckContents == 6)
  464. { format(truckcontentname, sizeof(truckcontentname), "{FF0606}Illegal drugs"); }
  465. else if(iTruckContents == 7)
  466. { format(truckcontentname, sizeof(truckcontentname), "{FF0606}Illegal materials"); }
  467. format(string, sizeof(string), "Vehicle registration: %s (%d)", GetVehicleName(closestcar), closestcar);
  468. SendClientMessageEx(playerid, COLOR_WHITE, string);
  469. if(iTruckContents == 0)
  470. { format(truckcontentname, sizeof(truckcontentname), "%s", GetInventoryType(TruckDeliveringTo[closestcar])); }
  471. format(string, sizeof(string), "Content: %s", truckcontentname);
  472. SendClientMessageEx(playerid, COLOR_WHITE, string);
  473. if(IsACop(playerid))
  474. {
  475. SendClientMessageEx(playerid, COLOR_YELLOW, "To remove the illegal goods, type /clearcargo near the truck.");
  476. }
  477. if(PlayerInfo[playerid][pJob] == 20 || PlayerInfo[playerid][pJob2] == 20 || PlayerInfo[playerid][pJob3] == 20)
  478. {
  479. if(TruckDeliveringTo[closestcar] > 0 && TruckUsed[playerid] == INVALID_VEHICLE_ID)
  480. {
  481. SendClientMessageEx(playerid, COLOR_YELLOW, "To deliver the goods, type /hijackcargo as the driver.");
  482. }
  483. else if(TruckUsed[playerid] == INVALID_VEHICLE_ID)
  484. {
  485. SendClientMessageEx(playerid, COLOR_YELLOW, "To get goods, type /loadshipment as the driver.");
  486. }
  487. else if(TruckUsed[playerid] == closestcar && gPlayerCheckpointStatus[playerid] == CHECKPOINT_RETURNTRUCK)
  488. {
  489. SendClientMessageEx(playerid, COLOR_YELLOW, "This is your Shipment Transport Vehicle. You have not returned it to the docks yet for your pay.");
  490. }
  491. else if(TruckUsed[playerid] == closestcar)
  492. {
  493. SendClientMessageEx(playerid, COLOR_YELLOW, "This is your Shipment Transport Vehicle. You have not delivered your goods yet.");
  494. }
  495. else if(TruckUsed[playerid] != INVALID_VEHICLE_ID)
  496. {
  497. SendClientMessageEx(playerid, COLOR_YELLOW, "You are already on another delivery. Type /cancel shipment to cancel that delivery.");
  498. }
  499. }
  500. SendClientMessageEx(playerid, COLOR_GREEN,"_________________________________________________________");
  501. }
  502. else
  503. {
  504. SendClientMessageEx(playerid, COLOR_GRAD1, "You are not near a Shipment Transport Vehicle.");
  505. }
  506. return 1;
  507. }
  508. CMD:hijackcargo(playerid, params[])
  509. {
  510. if(PlayerInfo[playerid][pJob] == 20 || PlayerInfo[playerid][pJob2] == 20 || PlayerInfo[playerid][pJob3] == 20)
  511. {
  512. new vehicleid = GetPlayerVehicleID(playerid);
  513. if(IsATruckerCar(vehicleid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  514. {
  515. if(!CheckPointCheck(playerid))
  516. {
  517. if(GetPVarInt(playerid, "LoadTruckTime") > 0)
  518. {
  519. SendClientMessageEx(playerid, COLOR_WHITE, "You are currently loading your Truck!");
  520. return 1;
  521. }
  522. if(TruckUsed[playerid] != INVALID_VEHICLE_ID)
  523. {
  524. SendClientMessageEx(playerid, COLOR_WHITE, "You are already on another delivery, type /cancel shipment to cancel that delivery.");
  525. return 1;
  526. }
  527. if(TruckDeliveringTo[vehicleid] == 0 && TruckContents{vehicleid} == 0)
  528. {
  529. SendClientMessageEx(playerid, COLOR_WHITE, "This Truck is empty, it does not contain any goods!");
  530. return 1;
  531. }
  532. if(IsPlayerInRangeOfPoint(playerid, 65, -1572.767822, 81.137527, 3.554687))
  533. {
  534. SendClientMessageEx(playerid, COLOR_WHITE, "You can not hijack when that close to the San Fierro Docks!");
  535. return 1;
  536. }
  537. if(!IsABoat(vehicleid))
  538. {
  539. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* You are now attempting to hijack the truck, please wait....");
  540. }
  541. else
  542. {
  543. if(PlayerInfo[playerid][pTruckSkill] >= 200)
  544. {
  545. SendClientMessageEx(playerid, COLOR_LIGHTBLUE,"* You are now attempting to hijack the boat, please wait....");
  546. }
  547. else return SendClientMessageEx(playerid, COLOR_WHITE, "Water shipments are restricted to Level 4+ Shipment Contracter.");
  548. }
  549. TogglePlayerControllable(playerid, 0);
  550. SetPVarInt(playerid, "IsFrozen", 1);
  551. SetPVarInt(playerid, "LoadTruckTime", 10);
  552. SetTimerEx("HijackTruck", 1000, 0, "dd", playerid);
  553. }
  554. else return SendClientMessageEx(playerid, COLOR_WHITE, "Please ensure that your current checkpoint is destroyed first (you either have material packages, or another existing checkpoint).");
  555. }
  556. else return SendClientMessageEx(playerid, COLOR_GREY, "You are not driving a Shipment Transport Vehicle!");
  557. }
  558. else return SendClientMessageEx(playerid, COLOR_GREY, "You are not a Shipment Contractor!");
  559. return 1;
  560. }
  561. CMD:loadshipment(playerid, params[])
  562. {
  563. if(PlayerInfo[playerid][pJob] == 20 || PlayerInfo[playerid][pJob2] == 20 || PlayerInfo[playerid][pJob3] == 20)
  564. {
  565. new vehicleid = GetPlayerVehicleID(playerid);
  566. if(IsATruckerCar(vehicleid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  567. {
  568. if(!CheckPointCheck(playerid))
  569. {
  570. if(GetPVarInt(playerid, "LoadTruckTime") > 0)
  571. {
  572. SendClientMessageEx(playerid, COLOR_WHITE, "You are currently loading the Shipment!");
  573. return 1;
  574. }
  575. if(TruckUsed[playerid] != INVALID_VEHICLE_ID)
  576. {
  577. SendClientMessageEx(playerid, COLOR_WHITE, "You are already on another delivery, type /cancel shipment to cancel that delivery.");
  578. return 1;
  579. }
  580. if(TruckContents{vehicleid} != 0)
  581. {
  582. return SendClientMessageEx(playerid, COLOR_GRAD2, "That vehicle is already loaded.");
  583. }
  584. if(TruckDeliveringTo[vehicleid] != INVALID_BUSINESS_ID && TruckContents{vehicleid} == 0)
  585. {
  586. return SendClientMessageEx(playerid, COLOR_GRAD2, "That vehicle is already loaded.");
  587. }
  588. if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 440 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 413) // Level Three Vehicle Check
  589. {
  590. if(PlayerInfo[playerid][pTruckSkill] < 100)
  591. {
  592. return SendClientMessageEx(playerid, COLOR_GRAD2, "Only level 3 Shipment Contractors may use this vehicle.");
  593. }
  594. }
  595. if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 482) // Level Five Vehicle Check
  596. {
  597. if(PlayerInfo[playerid][pTruckSkill] < 400)
  598. {
  599. return SendClientMessageEx(playerid, COLOR_GRAD2, "Only level 5 Shipment Contractors may use this vehicle.");
  600. }
  601. }
  602. if(!IsABoat(vehicleid))
  603. {
  604. SetPlayerCheckpoint(playerid,-1572.767822, 81.137527, 3.554687, 4);
  605. GameTextForPlayer(playerid, "~w~Waypoint set ~r~San Fierro Docks", 5000, 1);
  606. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Pick up some goods to transport with your Truck at San Fierro Docks (see checkpoint on radar).");
  607. }
  608. else
  609. {
  610. if(PlayerInfo[playerid][pTruckSkill] >= 200)
  611. {
  612. SetPlayerCheckpoint(playerid,2098.6543,-104.3568,-0.4820, 4);
  613. GameTextForPlayer(playerid, "~w~Waypoint set ~r~Palamino Docks", 5000, 1);
  614. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* Pick up some goods to transport with your Boat at Palamino Docks (see checkpoint on radar).");
  615. }
  616. else return SendClientMessageEx(playerid, COLOR_WHITE, "Water shipments are restricted to Level 4+ Shipment Contracter.");
  617. }
  618. gPlayerCheckpointStatus[playerid] = CHECKPOINT_LOADTRUCK;
  619. }
  620. else return SendClientMessageEx(playerid, COLOR_WHITE, "Please ensure that your current checkpoint is destroyed first (you either have material packages, or another existing checkpoint).");
  621. }
  622. else return SendClientMessageEx(playerid, COLOR_GREY, "You are not driving a Shipment Transport Vehicle!");
  623. }
  624. else return SendClientMessageEx(playerid, COLOR_GREY, "You are not a Shipment Contractor!");
  625. return 1;
  626. }
  627. hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  628. if(arrAntiCheat[playerid][ac_iFlags][AC_DIALOGSPOOFING] > 0) return 1;
  629. switch(dialogid) {
  630. case D_TRUCKDELIVER_WEPCHOICE: {
  631. if(!response) {
  632. switch(PlayerInfo[playerid][pTruckSkill]) {
  633. case 0 .. 49: GivePlayerValidWeapon(playerid, WEAPON_COLT45);
  634. case 50 .. 100: ShowPlayerDialogEx(playerid, D_TRUCKDELIVER_WEPCHOICE, DIALOG_STYLE_LIST, "Select your reward", "9mm\nShotgun", "Select", "");
  635. case 101 .. 200: ShowPlayerDialogEx(playerid, D_TRUCKDELIVER_WEPCHOICE, DIALOG_STYLE_LIST, "Select your reward", "9mm\nShotgun\nMP5", "Select", "");
  636. case 201 .. 400: ShowPlayerDialogEx(playerid, D_TRUCKDELIVER_WEPCHOICE, DIALOG_STYLE_LIST, "Select your reward", "9mm\nShotgun\nMP5\nDeagle", "Select", "");
  637. case 401: ShowPlayerDialogEx(playerid, D_TRUCKDELIVER_WEPCHOICE, DIALOG_STYLE_LIST, "Select your reward", "9mm\nShotgun\nMP5\nDeagle\nAK-47", "Select", "");
  638. default: ShowPlayerDialogEx(playerid, D_TRUCKDELIVER_WEPCHOICE, DIALOG_STYLE_LIST, "Select your reward", "9mm\nShotgun\nMP5\nDeagle\nAK-47", "Select", "");
  639. }
  640. return 1;
  641. }
  642. else {
  643. switch(listitem) {
  644. case 0: GivePlayerValidWeapon(playerid, WEAPON_COLT45);
  645. case 1: GivePlayerValidWeapon(playerid, WEAPON_SHOTGUN);
  646. case 2: GivePlayerValidWeapon(playerid, WEAPON_MP5);
  647. case 3: GivePlayerValidWeapon(playerid, WEAPON_DEAGLE);
  648. case 4: GivePlayerValidWeapon(playerid, WEAPON_AK47);
  649. }
  650. return 1;
  651. }
  652. }
  653. }
  654. return 0;
  655. }