backpack.pwn 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Backpack 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. stock IsBackpackAvailable(playerid)
  35. {
  36. #if defined zombiemode
  37. if(zombieevent == 1 && GetPVarType(playerid, "pIsZombie"))
  38. return 0;
  39. #endif
  40. if(GetPVarType(playerid, "PlayerCuffed") || GetPVarType(playerid, "Injured") || GetPVarType(playerid, "IsFrozen") || GetPVarInt(playerid, "EMSAttempt") != 0 || HungerPlayerInfo[playerid][hgInEvent] != 0 || PlayerInfo[playerid][pHospital] > 0 || PlayerInfo[playerid][pAccountRestricted] != 0)
  41. return 0;
  42. if(GetPVarType(playerid, "IsInArena") || GetPVarInt( playerid, "EventToken") != 0 || IsPlayerInAnyVehicle(playerid) || GetPVarType(playerid, "AttemptingLockPick") || GetPVarInt(playerid, "WatchingTV") || PlayerInfo[playerid][pJailTime] > 0 || !PlayerInfo[playerid][pBEquipped])
  43. return 0;
  44. return 1;
  45. }
  46. stock GetBackpackFreeSlotGun(playerid) {
  47. new slot;
  48. for(new g = 6; g < 11; g++)
  49. {
  50. if(PlayerInfo[playerid][pBItems][g] == 0)
  51. {
  52. slot = g;
  53. break;
  54. }
  55. }
  56. return slot;
  57. }
  58. ShowBackpackMenu(playerid, dialogid, extramsg[]) {
  59. new dgTitle[128],
  60. string[15];
  61. szMiscArray[0] = 0;
  62. if(!IsBackpackAvailable(playerid)) {
  63. DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
  64. return 1;
  65. }
  66. if(!GetPVarType(playerid, "BackpackOpen") || !GetPVarType(playerid, "BackpackProt")) {
  67. DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
  68. return 1;
  69. }
  70. format(dgTitle, sizeof(dgTitle), "%s Items %s", GetBackpackName(PlayerInfo[playerid][pBackpack]), extramsg);
  71. switch(dialogid) {
  72. case DIALOG_OBACKPACK: {
  73. format(szMiscArray, sizeof(szMiscArray), "Food ({FFF94D}%d Meals{FFFFFF})\nNarcotics ({FFF94D}%d Grams{FFFFFF})\nGuns\nEnergy Bars ({FFF94D}%d Bars{FFFFFF})", PlayerInfo[playerid][pBItems][0], GetBackpackNarcoticsGrams(playerid), PlayerInfo[playerid][pBItems][11]);
  74. if(PlayerInfo[playerid][pBItems][5] != 0 && (IsACop(playerid) || IsAMedic(playerid) || IsAGovernment(playerid) || IsATowman(playerid))) format(szMiscArray, sizeof(szMiscArray), "%s\nMedic & Kevlar Vest Kits ({FFF94D}%d{FFFFFF})",szMiscArray, PlayerInfo[playerid][pBItems][5]);
  75. ShowPlayerDialogEx(playerid, DIALOG_OBACKPACK, DIALOG_STYLE_LIST, dgTitle, szMiscArray, "Select", "Cancel");
  76. }
  77. case DIALOG_BFOOD: {
  78. ShowPlayerDialogEx(playerid, DIALOG_BFOOD, DIALOG_STYLE_MSGBOX, dgTitle, "Are you sure you want to use this meal now?", "Confirm", "Cancel");
  79. }
  80. case DIALOG_BMEDKIT: {
  81. ShowPlayerDialogEx(playerid, DIALOG_BMEDKIT, DIALOG_STYLE_MSGBOX, dgTitle, "Are you sure you want to use this Medical & Kevlar Vest kit now?", "Confirm", "Cancel");
  82. }
  83. case DIALOG_BNARCOTICS: {
  84. for(new i; i < sizeof(Drugs); ++i) {
  85. format(szMiscArray, sizeof(szMiscArray), "%s%s({FFF94D}%d{A9C4E4} Grams)\n", szMiscArray, Drugs[i], PlayerInfo[playerid][pBDrugs][i]);
  86. }
  87. ShowPlayerDialogEx(playerid, DIALOG_BNARCOTICS, DIALOG_STYLE_LIST, dgTitle, szMiscArray, "Select", "Cancel");
  88. }
  89. case DIALOG_BNARCOTICS2: {
  90. new pbi = GetPVarInt(playerid, "pbitemindex");
  91. format(dgTitle, sizeof(dgTitle), "{FFF94D}%d{A9C4E4} Grams of %s ({B20400}%d{A9C4E4} Total Grams)", PlayerInfo[playerid][pBDrugs][pbi], Drugs[pbi], GetBackpackNarcoticsGrams(playerid));
  92. ShowPlayerDialogEx(playerid, DIALOG_BNARCOTICS2, DIALOG_STYLE_LIST, dgTitle, "Withdraw\nDeposit", "Select", "Cancel");
  93. }
  94. case DIALOG_BNARCOTICS3: {
  95. new pbi = GetPVarInt(playerid, "pbitemindex");
  96. format(dgTitle, sizeof(dgTitle), "{FFF94D}%d{A9C4E4} Grams of %s({B20400}%d{A9C4E4} Total Grams)\n", PlayerInfo[playerid][pBDrugs][pbi], Drugs[pbi], GetBackpackNarcoticsGrams(playerid));
  97. format(szMiscArray, sizeof(szMiscArray), "%s\nEnter the amount to %s ", extramsg, (GetPVarInt(playerid, "bnwd")) ? ("deposit") : ("withdraw"));
  98. ShowPlayerDialogEx(playerid, DIALOG_BNARCOTICS3, DIALOG_STYLE_INPUT, dgTitle, szMiscArray, "Select", "Cancel");
  99. }
  100. case DIALOG_BGUNS: {
  101. new weapname[20], itemcount;
  102. for(new i = 6; i < 11; i++)
  103. {
  104. if(PlayerInfo[playerid][pBItems][i] > 0)
  105. {
  106. GetWeaponName(PlayerInfo[playerid][pBItems][i], weapname, sizeof(weapname));
  107. format(szMiscArray, sizeof(szMiscArray), "%s%s (%i)\n", szMiscArray, weapname, i);
  108. format(string, sizeof(string), "ListItem%dSId", itemcount);
  109. SetPVarInt(playerid, string, i);
  110. itemcount++;
  111. }
  112. }
  113. SetPVarInt(playerid, "DepositGunId", itemcount);
  114. strcat(szMiscArray, "Deposit a weapon");
  115. ShowPlayerDialogEx(playerid, DIALOG_BGUNS, DIALOG_STYLE_LIST, dgTitle, szMiscArray, "Select", "Cancel");
  116. }
  117. case DIALOG_ENERGYBARS: {
  118. DeletePVar(playerid, "bnwd");
  119. ShowPlayerDialogEx(playerid, DIALOG_ENERGYBARS, DIALOG_STYLE_LIST, dgTitle, "Withdraw\nDeposit", "Select", "Cancel");
  120. }
  121. case DIALOG_ENERGYBARS*2: {
  122. format(dgTitle, sizeof(dgTitle), "{FFF94D}%d {02B0F5}Energy Bars%s", (GetPVarInt(playerid, "bnwd")) ? PlayerInfo[playerid][mInventory][4]:PlayerInfo[playerid][pBItems][11], (GetPVarInt(playerid, "bnwd")) ? (" on hand"):(""));
  123. format(szMiscArray, sizeof(szMiscArray), "%s\nEnter the amount to %s:", extramsg, (GetPVarInt(playerid, "bnwd")) ? ("deposit") : ("withdraw"));
  124. ShowPlayerDialogEx(playerid, DIALOG_ENERGYBARS, DIALOG_STYLE_INPUT, dgTitle, szMiscArray, "Select", "Cancel");
  125. }
  126. }
  127. return 1;
  128. }
  129. stock GetBackpackName(backpackid) {
  130. new bpName[16];
  131. switch(backpackid) {
  132. case 1: bpName = "Small Backpack";
  133. case 2: bpName = "Medium Backpack";
  134. case 3: bpName = "Large Backpack";
  135. }
  136. return bpName;
  137. }
  138. stock GetBackpackNarcoticsGrams(playerid) {
  139. new grams;
  140. for(new i; i < sizeof(Drugs); ++i) grams += PlayerInfo[playerid][pBDrugs][i];
  141. return grams;
  142. }
  143. stock GetBackpackIngredientsGrams(playerid) {
  144. new grams;
  145. for(new i; i < sizeof(szIngredients); ++i) grams += PlayerInfo[playerid][pBIngredients][i];
  146. return grams;
  147. }
  148. stock CountBackpackGuns(playerid) {
  149. new count;
  150. for(new i = 6; i < 11); i++)
  151. if(PlayerInfo[playerid][pBItems][i] > 0)
  152. count++;
  153. return count;
  154. }
  155. CMD:shopbpack(playerid, params[]) {
  156. if(PlayerInfo[playerid][pShopTech] >= 1 || PlayerInfo[playerid][pAdmin] > 3)
  157. {
  158. new playertogive, type, orderid;
  159. if(sscanf(params, "uii", playertogive, type, orderid)) {
  160. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /shopbpack [player] [type] [orderid]");
  161. SendClientMessageEx(playerid, COLOR_WHITE, "Types: 1(Small Backpack), 2(Medium Backpack), 3(Large Backpack)");
  162. }
  163. else if(!(0 <= type <= 4)) {
  164. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /shopbpack [player] [type] [orderid]");
  165. SendClientMessageEx(playerid, COLOR_WHITE, "Types: 1(Small Backpack), 2(Medium Backpack), 3(Large Backpack)");
  166. }
  167. else {
  168. new
  169. TypeName[7],
  170. szMessage[87];
  171. switch(type)
  172. {
  173. case 1:
  174. {
  175. TypeName = "Small";
  176. SetPlayerAttachedObject(playertogive, 9, 371, 1, -0.002, -0.140999, -0.01, 8.69999, 88.8, -8.79993, 1.11, 0.963);
  177. }
  178. case 2:
  179. {
  180. TypeName = "Medium";
  181. SetPlayerAttachedObject(playertogive, 9, 371, 1, -0.002, -0.140999, -0.01, 8.69999, 88.8, -8.79993, 1.11, 0.963);
  182. }
  183. case 3:
  184. {
  185. TypeName = "Large";
  186. SetPlayerAttachedObject(playertogive, 9, 3026, 1, -0.254999, -0.109, -0.022999, 10.6, -1.20002, 3.4, 1.265, 1.242, 1.062);
  187. }
  188. }
  189. PlayerInfo[playertogive][pBackpack] = type;
  190. PlayerInfo[playertogive][pBEquipped] = 1;
  191. PlayerInfo[playertogive][pBStoredV] = INVALID_PLAYER_VEHICLE_ID;
  192. PlayerInfo[playertogive][pBStoredH] = INVALID_HOUSE_ID;
  193. format(szMessage, sizeof(szMessage), "You have successfully created a %s Backpack for %s (OrderID: %d).", TypeName, GetPlayerNameEx(playertogive), orderid);
  194. SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
  195. format(szMessage, sizeof(szMessage), "You now have a %s Backpack from %s (OrderID: %d).", TypeName, GetPlayerNameEx(playerid), orderid);
  196. SendClientMessageEx(playertogive, COLOR_WHITE, szMessage);
  197. SendClientMessageEx(playertogive, COLOR_GREY, "Use /backpackhelp to see the list of commands.");
  198. format(szMessage, sizeof(szMessage), "%s created a %s Backpack (%i) for %s(%d) (OrderID: %d).", GetPlayerNameEx(playerid), TypeName, type, GetPlayerNameEx(playertogive), GetPlayerSQLId(playertogive), orderid);
  199. Log("logs/shoplog.log", szMessage);
  200. }
  201. }
  202. else SendClientMessageEx(playerid, COLOR_GREY, " You are not allowed to use this command.");
  203. return 1;
  204. }
  205. hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  206. if(arrAntiCheat[playerid][ac_iFlags][AC_DIALOGSPOOFING] > 0) return 1;
  207. switch(dialogid)
  208. {
  209. case DIALOG_OBACKPACK: {
  210. if(response) {
  211. if(!IsBackpackAvailable(playerid)) {
  212. DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
  213. return 1;
  214. }
  215. switch(listitem) {
  216. case 0: { // Food
  217. if(PlayerInfo[playerid][pBItems][0] > 0) {
  218. ShowBackpackMenu(playerid, DIALOG_BFOOD, "- {02B0F5}Confirm meal use");
  219. }
  220. else {
  221. ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "- {A80000}You don't have any meals");
  222. }
  223. }
  224. case 1: { // Narcotics
  225. ShowBackpackMenu(playerid, DIALOG_BNARCOTICS, "- {02B0F5}Select a narcotic");
  226. }
  227. case 2: { // Guns
  228. if(PlayerInfo[playerid][pWRestricted] || PlayerInfo[playerid][pAccountRestricted]) return SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot use this option while being restricted.");
  229. ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}Select a weapon");
  230. }
  231. case 3: { // Energy Bars
  232. ShowBackpackMenu(playerid, DIALOG_ENERGYBARS, "- {02B0F5}Energy Bars");
  233. }
  234. case 4: { // Med Kits
  235. if(PlayerInfo[playerid][pBItems][5] > 0) {
  236. ShowBackpackMenu(playerid, DIALOG_BMEDKIT, "- {02B0F5}Confirm med kit use");
  237. }
  238. else {
  239. ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "- {A80000}You don't have any med kits");
  240. }
  241. }
  242. }
  243. }
  244. else {
  245. DeletePVar(playerid, "BackpackProt");
  246. DeletePVar(playerid, "BackpackOpen");
  247. }
  248. }
  249. case DIALOG_BFOOD: {
  250. if(response) {
  251. if(!IsBackpackAvailable(playerid)) {
  252. DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
  253. return 1;
  254. }
  255. if(GetPVarInt(playerid, "BackpackMeal") == 1) {
  256. ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "- {A80000}You're already using a meal.");
  257. }
  258. else
  259. {
  260. defer FinishMeal(playerid);
  261. SetPVarInt(playerid, "BackpackMeal", 1);
  262. ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0, 1);
  263. format(szMiscArray, sizeof(szMiscArray), "{FF8000}** {C2A2DA}%s opens a backpack and takes out a Full Meal.", GetPlayerNameEx(playerid));
  264. SendClientMessageEx(playerid, COLOR_WHITE, "You are taking the Meal from your backpack, please wait.");
  265. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  266. }
  267. }
  268. else {
  269. ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "");
  270. }
  271. }
  272. case DIALOG_BMEDKIT: {
  273. if(response && (IsACop(playerid) || IsAMedic(playerid) || IsAGovernment(playerid))) {
  274. if(!IsBackpackAvailable(playerid)) {
  275. DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
  276. return 1;
  277. }
  278. if(GetPVarInt(playerid, "BackpackMedKit") == 1) {
  279. ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "- {A80000}You're already using a med kit.");
  280. }
  281. else
  282. {
  283. defer FinishMedKit(playerid);
  284. SetPVarInt(playerid, "BackpackMedKit", 1);
  285. ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0, 1);
  286. format(szMiscArray, sizeof(szMiscArray), "{FF8000}** {C2A2DA}%s opens a backpack and takes out a Kevlar Vest & First Aid Kit inside.", GetPlayerNameEx(playerid));
  287. SendClientMessageEx(playerid, COLOR_WHITE, "You are taking the Med Kit from your backpack, please wait.");
  288. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  289. }
  290. }
  291. else {
  292. ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "");
  293. }
  294. }
  295. case DIALOG_BNARCOTICS: {
  296. if(response) {
  297. if(!IsBackpackAvailable(playerid)) {
  298. DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
  299. return 1;
  300. }
  301. SetPVarInt(playerid, "pbitemindex", listitem);
  302. ShowBackpackMenu(playerid, DIALOG_BNARCOTICS2, "");
  303. }
  304. else {
  305. ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "");
  306. }
  307. }
  308. case DIALOG_BNARCOTICS2: {
  309. if(response) {
  310. if(!IsBackpackAvailable(playerid)) {
  311. DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
  312. return 1;
  313. }
  314. SetPVarInt(playerid, "bnwd", listitem);
  315. ShowBackpackMenu(playerid, DIALOG_BNARCOTICS3, "");
  316. }
  317. else {
  318. ShowBackpackMenu(playerid, DIALOG_BNARCOTICS, "- {02B0F5}Select a narcotic");
  319. }
  320. }
  321. case DIALOG_BNARCOTICS3: {
  322. if(response) {
  323. if(!IsBackpackAvailable(playerid)) {
  324. DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
  325. return 1;
  326. }
  327. new pbi = GetPVarInt(playerid, "pbitemindex");
  328. if(GetPVarInt(playerid, "bnwd")) {
  329. new namount, maxgrams, dInfo[135];
  330. if(sscanf(inputtext, "d", namount)) return ShowBackpackMenu(playerid, DIALOG_BNARCOTICS3, "{B20400}Wrong input{A9C4E4}");
  331. if(namount < 1) return ShowBackpackMenu(playerid, DIALOG_BNARCOTICS3, "{B20400}Wrong input{A9C4E4}\nYou cannot put the amount less than 1");
  332. switch(PlayerInfo[playerid][pBackpack]) {
  333. case 1: maxgrams = 40;
  334. case 2: maxgrams = 100;
  335. case 3: maxgrams = 250;
  336. }
  337. if(namount > (maxgrams-GetBackpackNarcoticsGrams(playerid)))
  338. {
  339. format(dInfo, sizeof(dInfo), "{B20400}Wrong input, you can only store %d grams{A9C4E4}\nGrams available to store left {FFF600}%d{A9C4E4}\nEnter the amount to deposit", maxgrams, maxgrams-GetBackpackNarcoticsGrams(playerid));
  340. ShowBackpackMenu(playerid, DIALOG_BNARCOTICS3, dInfo);
  341. return 1;
  342. }
  343. if(PlayerInfo[playerid][pDrugs][pbi] >= namount) PlayerInfo[playerid][pDrugs][pbi] -= namount;
  344. else return ShowBackpackMenu(playerid, DIALOG_BNARCOTICS3, "{B20400}Wrong input{A9C4E4}\nYou don't have that that amount of grams.");
  345. PlayerInfo[playerid][pBDrugs][pbi] += namount;
  346. format(szMiscArray, sizeof(szMiscArray), "You have deposited %d grams of %s in your backpack.", namount, Drugs[pbi]);
  347. SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  348. new ip[MAX_PLAYER_NAME];
  349. GetPlayerIp(playerid, ip, sizeof(ip));
  350. format(szMiscArray, sizeof(szMiscArray), "[DRUGS] %s(%d) (IP:%s) deposited %d grams of %s (%d grams Total) [BACKPACK %d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), ip, namount, Drugs[pbi], PlayerInfo[playerid][pDrugs][pbi], PlayerInfo[playerid][pBackpack]);
  351. Log("logs/backpack.log", szMiscArray);
  352. ShowBackpackMenu(playerid, DIALOG_BNARCOTICS, "- {02B0F5}Select a narcotic");
  353. }
  354. else {
  355. new namount, dInfo[135];
  356. if(sscanf(inputtext, "d", namount)) return ShowBackpackMenu(playerid, DIALOG_BNARCOTICS3, "{B20400}Wrong input{A9C4E4}");
  357. if(namount < 1) return ShowBackpackMenu(playerid, DIALOG_BNARCOTICS3, "{B20400}Wrong input{A9C4E4}\nYou cannot put the amount less than 1");
  358. if(namount > PlayerInfo[playerid][pBDrugs][pbi])
  359. {
  360. format(dInfo, sizeof(dInfo), "{B20400}Wrong input, you only have %d grams of %s{A9C4E4}\nGrams trying to withdraw {FFF600}%d{A9C4E4}\nEnter the amount to deposit", PlayerInfo[playerid][pBDrugs][pbi], Drugs[pbi], namount);
  361. ShowBackpackMenu(playerid, DIALOG_BNARCOTICS3, dInfo);
  362. return 1;
  363. }
  364. PlayerInfo[playerid][pBDrugs][pbi] -= namount;
  365. PlayerInfo[playerid][pDrugs][pbi] += namount;
  366. format(szMiscArray, sizeof(szMiscArray), "You have withdrawn %d grams of %s in your backpack.", namount, Drugs[pbi]);
  367. SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  368. new ip[MAX_PLAYER_NAME];
  369. GetPlayerIp(playerid, ip, sizeof(ip));
  370. format(szMiscArray, sizeof(szMiscArray), "[DRUGS] %s(%d) (IP:%s) withdrawn %d grams of %s (%d grams Total) [BACKPACK %d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), ip, namount, Drugs[pbi], PlayerInfo[playerid][pBDrugs][pbi], PlayerInfo[playerid][pBackpack]);
  371. Log("logs/backpack.log", szMiscArray);
  372. ShowBackpackMenu(playerid, DIALOG_BNARCOTICS, "- {02B0F5}Select a narcotic");
  373. }
  374. }
  375. else {
  376. ShowBackpackMenu(playerid, DIALOG_BNARCOTICS2, "");
  377. }
  378. }
  379. case DIALOG_BGUNS: {
  380. if(response) {
  381. if(!IsBackpackAvailable(playerid)) {
  382. DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
  383. return 1;
  384. }
  385. new szDialog[130], weapname[20];
  386. if(listitem == GetPVarInt(playerid, "DepositGunId")) {
  387. switch(PlayerInfo[playerid][pBackpack]) {
  388. case 1: {
  389. new myweapons[2], itemcount;
  390. GetPlayerWeaponData(playerid, 1, myweapons[0], myweapons[1]);
  391. if(myweapons[0] > 0 && myweapons[0] != 9 && myweapons[0] != 4 && PlayerInfo[playerid][pGuns][1] == myweapons[0] && PlayerInfo[playerid][pAGuns][1] == 0)
  392. {
  393. GetWeaponName(myweapons[0], weapname, sizeof(weapname));
  394. format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
  395. format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
  396. SetPVarInt(playerid, szMiscArray, myweapons[0]);
  397. itemcount++;
  398. }
  399. GetPlayerWeaponData(playerid, 10, myweapons[0], myweapons[1]);
  400. if(myweapons[0] > 0 && PlayerInfo[playerid][pGuns][10] == myweapons[0] && PlayerInfo[playerid][pAGuns][10] == 0)
  401. {
  402. GetWeaponName(myweapons[0], weapname, sizeof(weapname));
  403. format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
  404. format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
  405. SetPVarInt(playerid, szMiscArray, myweapons[0]);
  406. itemcount++;
  407. }
  408. GetPlayerWeaponData(playerid, 2, myweapons[0], myweapons[1]);
  409. if(myweapons[0] > 0 && pTazer{playerid} == 0 && PlayerInfo[playerid][pGuns][2] == myweapons[0] && PlayerInfo[playerid][pAGuns][2] == 0)
  410. {
  411. GetWeaponName(myweapons[0], weapname, sizeof(weapname));
  412. format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
  413. format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
  414. SetPVarInt(playerid, szMiscArray, myweapons[0]);
  415. itemcount++;
  416. }
  417. if(strlen(szDialog) > 0) ShowPlayerDialogEx(playerid, DIALOG_BGUNS2, DIALOG_STYLE_LIST, "Select a weapon to deposit", szDialog, "Select", "Cancel");
  418. else {
  419. ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}Select a weapon - No guns to store");
  420. }
  421. }
  422. case 2, 3: {
  423. new myweapons[2], itemcount;
  424. GetPlayerWeaponData(playerid, 1, myweapons[0], myweapons[1]);
  425. if(myweapons[0] > 0 && myweapons[0] != 9 && myweapons[0] != 4 && PlayerInfo[playerid][pGuns][1] == myweapons[0] && PlayerInfo[playerid][pAGuns][1] == 0)
  426. {
  427. GetWeaponName(myweapons[0], weapname, sizeof(weapname));
  428. format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
  429. format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
  430. SetPVarInt(playerid, szMiscArray, myweapons[0]);
  431. itemcount++;
  432. }
  433. GetPlayerWeaponData(playerid, 10, myweapons[0], myweapons[1]);
  434. if(myweapons[0] > 0 && PlayerInfo[playerid][pGuns][10] == myweapons[0] && PlayerInfo[playerid][pAGuns][10] == 0)
  435. {
  436. GetWeaponName(myweapons[0], weapname, sizeof(weapname));
  437. format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
  438. format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
  439. SetPVarInt(playerid, szMiscArray, myweapons[0]);
  440. itemcount++;
  441. }
  442. GetPlayerWeaponData(playerid, 2, myweapons[0], myweapons[1]);
  443. if(myweapons[0] > 0 && pTazer{playerid} == 0 && PlayerInfo[playerid][pGuns][2] == myweapons[0] && PlayerInfo[playerid][pAGuns][2] == 0)
  444. {
  445. GetWeaponName(myweapons[0], weapname, sizeof(weapname));
  446. format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
  447. format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
  448. SetPVarInt(playerid, szMiscArray, myweapons[0]);
  449. itemcount++;
  450. }
  451. GetPlayerWeaponData(playerid, 3, myweapons[0], myweapons[1]);
  452. if(myweapons[0] > 0 && PlayerInfo[playerid][pGuns][3] == myweapons[0] && PlayerInfo[playerid][pAGuns][3] == 0)
  453. {
  454. GetWeaponName(myweapons[0], weapname, sizeof(weapname));
  455. format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
  456. format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
  457. SetPVarInt(playerid, szMiscArray, myweapons[0]);
  458. itemcount++;
  459. }
  460. GetPlayerWeaponData(playerid, 4, myweapons[0], myweapons[1]);
  461. if(myweapons[0] > 0 && PlayerInfo[playerid][pGuns][4] == myweapons[0] && PlayerInfo[playerid][pAGuns][4] == 0)
  462. {
  463. GetWeaponName(myweapons[0], weapname, sizeof(weapname));
  464. format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
  465. format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
  466. SetPVarInt(playerid, szMiscArray, myweapons[0]);
  467. itemcount++;
  468. }
  469. GetPlayerWeaponData(playerid, 5, myweapons[0], myweapons[1]);
  470. if(myweapons[0] > 0 && PlayerInfo[playerid][pGuns][5] == myweapons[0] && PlayerInfo[playerid][pAGuns][5] == 0)
  471. {
  472. GetWeaponName(myweapons[0], weapname, sizeof(weapname));
  473. format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
  474. format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
  475. SetPVarInt(playerid, szMiscArray, myweapons[0]);
  476. itemcount++;
  477. }
  478. GetPlayerWeaponData(playerid, 6, myweapons[0], myweapons[1]);
  479. if(myweapons[0] > 0 && PlayerInfo[playerid][pGuns][6] == myweapons[0] && PlayerInfo[playerid][pAGuns][6] == 0)
  480. {
  481. GetWeaponName(myweapons[0], weapname, sizeof(weapname));
  482. format(szDialog, sizeof(szDialog), "%s%s (%d)\n", szDialog, weapname, myweapons[0]);
  483. format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", itemcount);
  484. SetPVarInt(playerid, szMiscArray, myweapons[0]);
  485. itemcount++;
  486. }
  487. if(strlen(szDialog) > 0) ShowPlayerDialogEx(playerid, DIALOG_BGUNS2, DIALOG_STYLE_LIST, "Select a weapon to deposit", szDialog, "Select", "Cancel");
  488. else {
  489. ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}Select a weapon - No guns to store");
  490. }
  491. }
  492. }
  493. }
  494. else {
  495. format(szMiscArray, sizeof(szMiscArray), "ListItem%dSId", listitem);
  496. new slot = GetPVarInt(playerid, szMiscArray);
  497. if(PlayerInfo[playerid][pBItems][slot] > 0) {
  498. new aWeapons[13][2];
  499. for(new i; i < 13; ++i) {
  500. GetPlayerWeaponData(playerid, i, aWeapons[i][0], aWeapons[i][1]);
  501. if(aWeapons[i][0] == PlayerInfo[playerid][pBItems][slot]) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are already carrying this weapon.");
  502. }
  503. GetWeaponName(PlayerInfo[playerid][pBItems][slot], weapname, sizeof(weapname));
  504. GivePlayerValidWeapon(playerid, PlayerInfo[playerid][pBItems][slot]);
  505. DeletePVar(playerid, szMiscArray);
  506. format(szMiscArray, sizeof(szMiscArray), "You have withdrawn a %s from your backpack.", weapname);
  507. SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  508. format(szMiscArray, sizeof(szMiscArray), "* %s has withdrawn a %s from their backpack.", GetPlayerNameEx(playerid), weapname);
  509. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  510. new ip[MAX_PLAYER_NAME];
  511. GetPlayerIp(playerid, ip, sizeof(ip));
  512. format(szMiscArray, sizeof(szMiscArray), "[WEAPONS] %s(%d) (IP:%s) withdrawn a %s(%d) [BACKPACK %d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), ip, weapname, PlayerInfo[playerid][pBItems][slot], PlayerInfo[playerid][pBackpack]);
  513. Log("logs/backpack.log", szMiscArray);
  514. PlayerInfo[playerid][pBItems][slot] = 0;
  515. ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}Select a weapon");
  516. return 1;
  517. }
  518. }
  519. }
  520. else {
  521. ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "");
  522. }
  523. }
  524. case DIALOG_BGUNS2: {
  525. if(response) {
  526. if(!IsBackpackAvailable(playerid)) {
  527. DeletePVar(playerid, "BackpackOpen"), DeletePVar(playerid, "BackpackProt"), SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
  528. return 1;
  529. }
  530. new handguns, primguns, wbid, slot = GetBackpackFreeSlotGun(playerid), weapname[32];
  531. for(new i = 6; i < 11; i++) {
  532. if(PlayerInfo[playerid][pBItems][i] > 0) {
  533. if(IsWeaponHandgun(PlayerInfo[playerid][pBItems][i])) handguns++;
  534. else if(IsWeaponPrimary(PlayerInfo[playerid][pBItems][i])) primguns++;
  535. }
  536. }
  537. switch(PlayerInfo[playerid][pBackpack]) {
  538. case 1: {
  539. format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", listitem);
  540. wbid = GetPVarInt(playerid, szMiscArray);
  541. if(handguns > 1 || primguns > 0 || IsWeaponPrimary(wbid)) {
  542. ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}You can only carry 2 handguns");
  543. return 1;
  544. }
  545. if(slot != 0 && PlayerInfo[playerid][pGuns][GetWeaponSlot(wbid)] == wbid && PlayerInfo[playerid][pAGuns][GetWeaponSlot(wbid)] == 0) {
  546. RemovePlayerWeapon(playerid, wbid);
  547. PlayerInfo[playerid][pBItems][slot] = wbid;
  548. GetWeaponName(wbid, weapname, sizeof(weapname));
  549. format(szMiscArray, sizeof(szMiscArray), "You have deposited a %s inside your backpack.", weapname);
  550. SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  551. format(szMiscArray, sizeof(szMiscArray), "* %s has deposited a %s inside their backpack.", GetPlayerNameEx(playerid), weapname);
  552. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  553. new ip[MAX_PLAYER_NAME];
  554. GetPlayerIp(playerid, ip, sizeof(ip));
  555. format(szMiscArray, sizeof(szMiscArray), "[WEAPONS] %s(%d) (IP:%s) deposited a %s(%d) in slot %d [BACKPACK %d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), ip, weapname, wbid, slot, PlayerInfo[playerid][pBackpack]);
  556. Log("logs/backpack.log", szMiscArray);
  557. ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}Select a weapon");
  558. return 1;
  559. }
  560. else {
  561. ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}Select a weapon ERROR");
  562. }
  563. }
  564. case 2: {
  565. format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", listitem);
  566. wbid = GetPVarInt(playerid, szMiscArray);
  567. if((handguns >= 2 && IsWeaponHandgun(wbid)) || (IsWeaponPrimary(wbid) && primguns >= 1) || (handguns >= 2 && primguns >= 1)) {
  568. ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}You can only carry 2 handguns and 1 primary");
  569. return 1;
  570. }
  571. if(slot != 0 && PlayerInfo[playerid][pGuns][GetWeaponSlot(wbid)] == wbid && PlayerInfo[playerid][pAGuns][GetWeaponSlot(wbid)] == 0) {
  572. RemovePlayerWeapon(playerid, wbid);
  573. PlayerInfo[playerid][pBItems][slot] = wbid;
  574. GetWeaponName(wbid, weapname, sizeof(weapname));
  575. format(szMiscArray, sizeof(szMiscArray), "You have deposited a %s inside your backpack.", weapname);
  576. SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  577. format(szMiscArray, sizeof(szMiscArray), "* %s has deposited a %s inside their backpack.", GetPlayerNameEx(playerid), weapname);
  578. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  579. new ip[MAX_PLAYER_NAME];
  580. GetPlayerIp(playerid, ip, sizeof(ip));
  581. format(szMiscArray, sizeof(szMiscArray), "[WEAPONS] %s(%d) (IP:%s) deposited a %s(%d) in slot %d [BACKPACK %d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), ip, weapname, wbid, slot, PlayerInfo[playerid][pBackpack]);
  582. Log("logs/backpack.log", szMiscArray);
  583. ShowBackpackMenu(playerid, DIALOG_BGUNS, "- {02B0F5}Select a weapon");
  584. return 1;
  585. }
  586. else {
  587. ShowBackpackMenu(playerid, DIALOG_BGUNS, "- Select a weapon ERROR");
  588. }
  589. }
  590. case 3: {
  591. format(szMiscArray, sizeof(szMiscArray), "ListItem%dWId", listitem);
  592. wbid = GetPVarInt(playerid, szMiscArray);
  593. if((handguns >= 2 && primguns >= 3) || (primguns >= 3 && IsWeaponPrimary(wbid)) || (handguns >= 2 && IsWeaponHandgun(wbid))) {
  594. ShowBackpackMenu(playerid, DIALOG_BGUNS, "- You can only carry 2 handguns and 3 primary");
  595. return 1;
  596. }
  597. if(slot != 0 && PlayerInfo[playerid][pGuns][GetWeaponSlot(wbid)] == wbid && PlayerInfo[playerid][pAGuns][GetWeaponSlot(wbid)] == 0) {
  598. RemovePlayerWeapon(playerid, wbid);
  599. PlayerInfo[playerid][pBItems][slot] = wbid;
  600. GetWeaponName(wbid, weapname, sizeof(weapname));
  601. format(szMiscArray, sizeof(szMiscArray), "You have deposited a %s inside your backpack.", weapname);
  602. SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  603. format(szMiscArray, sizeof(szMiscArray), "* %s has deposited a %s inside their backpack.", GetPlayerNameEx(playerid), weapname);
  604. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  605. new ip[MAX_PLAYER_NAME];
  606. GetPlayerIp(playerid, ip, sizeof(ip));
  607. format(szMiscArray, sizeof(szMiscArray), "[WEAPONS] %s(%d) (IP:%s) deposited a %s(%d) in slot %d [BACKPACK %d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), ip, weapname, wbid, slot, PlayerInfo[playerid][pBackpack]);
  608. Log("logs/backpack.log", szMiscArray);
  609. ShowBackpackMenu(playerid, DIALOG_BGUNS, "- Select a weapon");
  610. return 1;
  611. }
  612. else {
  613. ShowBackpackMenu(playerid, DIALOG_BGUNS, "- Select a weapon ERROR");
  614. }
  615. }
  616. }
  617. }
  618. else {
  619. ShowBackpackMenu(playerid, DIALOG_BGUNS, "- Select a weapon");
  620. }
  621. }
  622. case DIALOG_BMEALSTORE: {
  623. if(response) {
  624. PlayerInfo[playerid][pBItems][0]++;
  625. format(szMiscArray,sizeof(szMiscArray),"* You have stored a Full Meal in your backpack(%d meals).",PlayerInfo[playerid][pBItems][0]);
  626. SendClientMessage(playerid, COLOR_GRAD2, szMiscArray);
  627. }
  628. else {
  629. if (PlayerInfo[playerid][pFitness] >= 5)
  630. PlayerInfo[playerid][pFitness] -= 5;
  631. else
  632. PlayerInfo[playerid][pFitness] = 0;
  633. SetHealth(playerid, 100.0);
  634. }
  635. }
  636. case DIALOG_BDROP:
  637. {
  638. if(!response) return SendClientMessageEx(playerid, COLOR_WHITE, "You have successfully cancelled dropping your backpack.");
  639. if(PlayerInfo[playerid][pBackpack] > 0)
  640. {
  641. new choice[7];
  642. switch(PlayerInfo[playerid][pBackpack])
  643. {
  644. case 1: choice = "Small";
  645. case 2: choice = "Medium";
  646. case 3: choice = "Large";
  647. }
  648. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  649. format(szMiscArray, sizeof(szMiscArray), "You have dropped your %s Backpack.", choice);
  650. SendClientMessageEx(playerid, COLOR_WHITE, szMiscArray);
  651. RemovePlayerAttachedObject(playerid, 9);
  652. PlayerInfo[playerid][pBackpack] = 0;
  653. PlayerInfo[playerid][pBEquipped] = 0;
  654. PlayerInfo[playerid][pBStoredH] = INVALID_HOUSE_ID;
  655. PlayerInfo[playerid][pBStoredV] = INVALID_PLAYER_VEHICLE_ID;
  656. for(new i = 0; i < 10; i++)
  657. {
  658. PlayerInfo[playerid][pBItems][i] = 0;
  659. }
  660. format(szMiscArray, sizeof(szMiscArray), "* %s has thrown away their backpack.", GetPlayerNameEx(playerid));
  661. ProxDetector(30.0, playerid, szMiscArray, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  662. new ip[MAX_PLAYER_NAME];
  663. GetPlayerIp(playerid, ip, sizeof(ip));
  664. format(szMiscArray, sizeof(szMiscArray), "[DROP] %s(%d) (IP:%s) has thrown away his %s Backpack", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerIpEx(playerid), choice);
  665. Log("logs/backpack.log", szMiscArray);
  666. }
  667. else
  668. {
  669. SendClientMessageEx(playerid, COLOR_GREY, "You do not have a backpack!");
  670. }
  671. }
  672. }
  673. return 0;
  674. }
  675. CMD:sellbackpack(playerid, params[])
  676. {
  677. if(PlayerInfo[playerid][pBackpack] > 0)
  678. {
  679. if(!PlayerInfo[playerid][pBEquipped]) return SendClientMessageEx(playerid, COLOR_GREY, "You are are not wearing your backpack, you can wear it with /bwear.");
  680. if(!IsBackpackAvailable(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
  681. if(GetPVarType(playerid, "IsInArena")) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now, you are in an arena!");
  682. if(GetPVarInt( playerid, "EventToken") != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can't use this while you're in an event.");
  683. if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this while being inside the vehicle!");
  684. if(GetPVarInt(playerid, "EMSAttempt") != 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You can't use this command!");
  685. if(GetPVarInt(playerid, "sellingbackpack")) return SendClientMessageEx(playerid, COLOR_GRAD2, "You are already selling a backpack!");
  686. new string[128], giveplayerid, price, bptype[8];
  687. if(sscanf(params, "ui", giveplayerid, price)) {
  688. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /sellbackpack [player] [price]");
  689. SendClientMessageEx(playerid, COLOR_YELLOW, "WARNING: /sellbackpack will automatically remove all your items currently in your backpack.");
  690. return 1;
  691. }
  692. if(price < 0) {
  693. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /sellbackpack [player] [price]");
  694. SendClientMessageEx(playerid, COLOR_YELLOW, "WARNING: /sellbackpack will automatically remove all your items currently in your backpack.");
  695. return 1;
  696. }
  697. if(IsPlayerConnected(giveplayerid))
  698. {
  699. if(playerid == giveplayerid) return 1;
  700. if (ProxDetectorS(8.0, playerid, giveplayerid))
  701. {
  702. switch(PlayerInfo[playerid][pBackpack])
  703. {
  704. case 1: bptype = "Small";
  705. case 2: bptype = "Medium";
  706. case 3: bptype = "Large";
  707. }
  708. if(PlayerInfo[giveplayerid][pBackpack] > 0) return SendClientMessageEx(playerid, COLOR_GREY, "That player already has a backpack!");
  709. SetPVarInt(giveplayerid, "sellbackpack", playerid);
  710. SetPVarInt(giveplayerid, "sellbackpackprice", price);
  711. SetPVarInt(playerid, "sellingbackpack", 1);
  712. format(string, sizeof(string), "* %s has offered you a %s Backpack for $%s. /accept backpack to get the backpack.", GetPlayerNameEx(playerid), bptype, number_format(price));
  713. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
  714. format(string, sizeof(string), "* You have offered %s your %s Backpack for $%s.",GetPlayerNameEx(giveplayerid), bptype, number_format(price));
  715. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  716. }
  717. else
  718. {
  719. return SendClientMessageEx(playerid, COLOR_GREY, " That person is not near you!");
  720. }
  721. }
  722. else
  723. {
  724. return SendClientMessageEx(playerid, COLOR_GREY, " That person is not connected!");
  725. }
  726. }
  727. else return SendClientMessageEx(playerid, COLOR_GREY, "You do not own a backpack(Use /miscshop to get one with credits)");
  728. return 1;
  729. }
  730. CMD:listbitems(playerid, params[])
  731. {
  732. if(PlayerInfo[playerid][pAdmin] > 1 || PlayerInfo[playerid][pWatchdog] >= 2)
  733. {
  734. new string[128], giveplayerid;
  735. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /listbitems [player]");
  736. if(IsPlayerConnected(giveplayerid))
  737. {
  738. if(PlayerInfo[giveplayerid][pBackpack] < 1) return SendClientMessageEx(playerid, COLOR_GREY, "That player does not have a backpack!");
  739. new btype[8], weaponname[50];
  740. switch(PlayerInfo[giveplayerid][pBackpack])
  741. {
  742. case 1: btype = "Small";
  743. case 2: btype = "Medium";
  744. case 3: btype = "Large";
  745. }
  746. SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
  747. format(string, sizeof(string), "*** %s' %s Backpack items... ***", GetPlayerNameEx(giveplayerid), btype);
  748. SendClientMessageEx(playerid, COLOR_WHITE, string);
  749. if(PlayerInfo[giveplayerid][pBItems][0] > 0)
  750. {
  751. format(string, sizeof(string), "(Backpack) %d meals.", PlayerInfo[giveplayerid][pBItems][0]);
  752. SendClientMessageEx(playerid, COLOR_GREY, string);
  753. }
  754. for(new i; i < sizeof(Drugs); ++i) {
  755. if(PlayerInfo[giveplayerid][pBDrugs][i] > 0) {
  756. format(string, sizeof(string), "(Backpack) %d grams of %s.", PlayerInfo[giveplayerid][pBDrugs][i], Drugs[i]);
  757. SendClientMessageEx(playerid, COLOR_GREY, string);
  758. }
  759. }
  760. if(PlayerInfo[giveplayerid][pBItems][5] > 0)
  761. {
  762. format(string, sizeof(string), "(Backpack) %d Medical Kits.", PlayerInfo[giveplayerid][pBItems][5]);
  763. SendClientMessageEx(playerid, COLOR_GREY, string);
  764. }
  765. if(PlayerInfo[giveplayerid][pBItems][11] > 0)
  766. {
  767. format(string, sizeof(string), "(Backpack) %d Energy Bars.", PlayerInfo[giveplayerid][pBItems][11]);
  768. SendClientMessageEx(playerid, COLOR_GREY, string);
  769. }
  770. new sent;
  771. for (new i = 6; i < 11; i++)
  772. {
  773. if(PlayerInfo[giveplayerid][pBItems][i] > 0)
  774. {
  775. if(!sent)
  776. {
  777. format(string, sizeof(string), "*** %s' %s Backpack weapons... ***", GetPlayerNameEx(giveplayerid), btype);
  778. SendClientMessageEx(playerid, COLOR_WHITE, string);
  779. sent = 1;
  780. }
  781. GetWeaponName(PlayerInfo[giveplayerid][pBItems][i], weaponname, sizeof(weaponname));
  782. format(string, sizeof(string), "Weapon: %s.", weaponname);
  783. SendClientMessageEx(playerid, COLOR_GRAD1, string);
  784. }
  785. }
  786. SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
  787. }
  788. else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
  789. }
  790. else
  791. {
  792. SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
  793. }
  794. return 1;
  795. }
  796. CMD:bsearch(playerid, params[])
  797. {
  798. if(IsACop(playerid) || PlayerInfo[playerid][pJob] == 8 || PlayerInfo[playerid][pJob2] == 8 || PlayerInfo[playerid][pJob3] == 8)
  799. {
  800. new string[128], giveplayerid;
  801. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bsearch [player]");
  802. if(IsPlayerConnected(giveplayerid) && ProxDetectorS(8.0, playerid, giveplayerid))
  803. {
  804. if(giveplayerid == playerid) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot search yourself!");
  805. if(PlayerInfo[giveplayerid][pBEquipped] < 1) return SendClientMessageEx(playerid, COLOR_GREY, "That player is not wearing a backpack!");
  806. new btype[8], weaponname[50];
  807. switch(PlayerInfo[giveplayerid][pBackpack])
  808. {
  809. case 1: btype = "Small";
  810. case 2: btype = "Medium";
  811. case 3: btype = "Large";
  812. }
  813. SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
  814. format(string, sizeof(string), "*** %s' %s Backpack items... ***", GetPlayerNameEx(giveplayerid), btype);
  815. SendClientMessageEx(playerid, COLOR_WHITE, string);
  816. if(PlayerInfo[giveplayerid][pBItems][0] > 0)
  817. {
  818. format(string, sizeof(string), "(Backpack) %d meals.", PlayerInfo[giveplayerid][pBItems][0]);
  819. SendClientMessageEx(playerid, COLOR_GREY, string);
  820. }
  821. for(new i; i < sizeof(Drugs); ++i) {
  822. if(PlayerInfo[giveplayerid][pBDrugs][i] > 0) {
  823. format(string, sizeof(string), "(Backpack) %d grams of %s.", PlayerInfo[giveplayerid][pBDrugs][i], Drugs[i]);
  824. SendClientMessageEx(playerid, COLOR_GREY, string);
  825. }
  826. }
  827. if(PlayerInfo[giveplayerid][pBItems][5] > 0)
  828. {
  829. format(string, sizeof(string), "(Backpack) %d Medical Kits.", PlayerInfo[giveplayerid][pBItems][5]);
  830. SendClientMessageEx(playerid, COLOR_GREY, string);
  831. }
  832. if(PlayerInfo[giveplayerid][pBItems][11] > 0)
  833. {
  834. format(string, sizeof(string), "(Backpack) %d Energy Bars.", PlayerInfo[giveplayerid][pBItems][11]);
  835. SendClientMessageEx(playerid, COLOR_GREY, string);
  836. }
  837. new sent;
  838. for (new i = 6; i < 11; i++)
  839. {
  840. if(PlayerInfo[giveplayerid][pBItems][i] > 0)
  841. {
  842. if(!sent)
  843. {
  844. format(string, sizeof(string), "*** %s' %s Backpack weapons... ***", GetPlayerNameEx(giveplayerid), btype);
  845. SendClientMessageEx(playerid, COLOR_WHITE, string);
  846. sent = 1;
  847. }
  848. GetWeaponName(PlayerInfo[giveplayerid][pBItems][i], weaponname, sizeof(weaponname));
  849. format(string, sizeof(string), "Weapon: %s.", weaponname);
  850. SendClientMessageEx(playerid, COLOR_GRAD1, string);
  851. }
  852. }
  853. SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
  854. format(string, sizeof(string), "* %s has searched %s's backpack for any illegal items.", GetPlayerNameEx(playerid),GetPlayerNameEx(giveplayerid));
  855. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  856. }
  857. else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
  858. }
  859. else
  860. {
  861. SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
  862. }
  863. return 1;
  864. }
  865. CMD:bremove(playerid, params[])
  866. {
  867. if (!IsACop(playerid))
  868. {
  869. SendClientMessageEx(playerid,COLOR_GREY,"You're not a law enforcement officer.");
  870. return 1;
  871. }
  872. new string[128], giveplayerid, item[6], bptype[8];
  873. if(sscanf(params, "us[6]", giveplayerid, item)) {
  874. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bremove [player] [item]");
  875. SendClientMessageEx(playerid, COLOR_YELLOW, "ITEMS: [All drugs - see /mydrugs], Guns, Meals");
  876. return 1;
  877. }
  878. if(IsPlayerConnected(giveplayerid))
  879. {
  880. if(playerid == giveplayerid) return 1;
  881. if (ProxDetectorS(8.0, playerid, giveplayerid))
  882. {
  883. if(PlayerInfo[giveplayerid][pBEquipped] < 1 && PlayerInfo[giveplayerid][pBackpack] < 1) return SendClientMessageEx(playerid, COLOR_GREY, "That player is not wearing a backpack!");
  884. switch(PlayerInfo[playerid][pBackpack])
  885. {
  886. case 1: bptype = "Small";
  887. case 2: bptype = "Medium";
  888. case 3: bptype = "Large";
  889. }
  890. new iDrugID = GetDrugID(item);
  891. if(iDrugID != -1) {
  892. format(string, sizeof(string), "* You have taken away %s's %s from their backpack.", GetPlayerNameEx(giveplayerid), Drugs[iDrugID]);
  893. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  894. format(string, sizeof(string), "* Officer %s has taken away your %s from your backpack.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), Drugs[iDrugID]);
  895. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
  896. format(string, sizeof(string), "* Officer %s has taken away %s's %s from their backpack.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), Drugs[iDrugID]);
  897. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  898. PlayerInfo[giveplayerid][pBDrugs][iDrugID] = 0;
  899. }
  900. else if(strcmp(item,"meals",true) == 0)
  901. {
  902. format(string, sizeof(string), "* You have taken away %s's meals from their backpack.", GetPlayerNameEx(giveplayerid));
  903. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  904. format(string, sizeof(string), "* Officer %s has taken away your meals from your backpack.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
  905. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
  906. format(string, sizeof(string), "* Officer %s has taken away %s's meals from their backpack.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
  907. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  908. PlayerInfo[giveplayerid][pBItems][0] = 0;
  909. }
  910. else if(strcmp(item,"guns",true) == 0)
  911. {
  912. format(string, sizeof(string), "* You have taken away %s's weapons from their backpack.", GetPlayerNameEx(giveplayerid));
  913. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  914. format(string, sizeof(string), "* Officer %s has taken away your weapons from your backpack.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
  915. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
  916. format(string, sizeof(string), "* Officer %s has taken away %s's weapons from their backpack.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
  917. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  918. for(new i = 6; i < 11; i++)
  919. {
  920. PlayerInfo[giveplayerid][pBItems][i] = 0;
  921. }
  922. }
  923. }
  924. else
  925. {
  926. return SendClientMessageEx(playerid, COLOR_GREY, " That person is not near you!");
  927. }
  928. }
  929. else
  930. {
  931. return SendClientMessageEx(playerid, COLOR_GREY, " That person is not connected!");
  932. }
  933. return 1;
  934. }
  935. CMD:bwear(playerid, params[])
  936. {
  937. if(PlayerInfo[playerid][pBackpack] > 0)
  938. {
  939. if(!IsBackpackAvailable(playerid) && PlayerInfo[playerid][pBEquipped]) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
  940. if(GetPVarType(playerid, "IsInArena")) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now, you are in an arena!");
  941. if(GetPVarInt( playerid, "EventToken") != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can't use this while you're in an event.");
  942. if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this while being inside the vehicle!");
  943. if(GetPVarInt(playerid, "EMSAttempt") != 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You can't use this command!");
  944. if(PlayerInfo[playerid][pBEquipped]) return SendClientMessageEx(playerid, COLOR_GREY, "You are already wearing your backpack, you can store it to your car/house with /bstore.");
  945. new string[128], btype[8], i = 0, Float: x, Float: y, Float: z, pvid = -1;
  946. if(PlayerInfo[playerid][pBStoredV] != INVALID_PLAYER_VEHICLE_ID)
  947. {
  948. for(i = 0 ; i < MAX_PLAYERVEHICLES; i++)
  949. {
  950. if(PlayerVehicleInfo[playerid][i][pvId] != INVALID_PLAYER_VEHICLE_ID && PlayerVehicleInfo[playerid][i][pvSlotId] == PlayerInfo[playerid][pBStoredV]) GetVehiclePos(PlayerVehicleInfo[playerid][i][pvId], x, y, z);
  951. if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
  952. {
  953. pvid = i;
  954. break;
  955. }
  956. }
  957. if(pvid == -1) return SendClientMessageEx(playerid,COLOR_GREY,"You are not near the vehicle where the backpack is stored.");
  958. new engine,lights,alarm,doors,bonnet,boot,objective;
  959. GetVehicleParamsEx(PlayerVehicleInfo[playerid][pvid][pvId],engine,lights,alarm,doors,bonnet,boot,objective);
  960. if(boot == VEHICLE_PARAMS_OFF || boot == VEHICLE_PARAMS_UNSET) return SendClientMessageEx(playerid, COLOR_GRAD3, "You can't take/put stuff inside the trunk if it's closed!(/car trunk to open it)");
  961. if(PlayerHoldingObject[playerid][9] != 0 || IsPlayerAttachedObjectSlotUsed(playerid, 9))
  962. RemovePlayerAttachedObject(playerid, 9), PlayerHoldingObject[playerid][9] = 0;
  963. switch(PlayerInfo[playerid][pBackpack])
  964. {
  965. case 1:
  966. {
  967. btype = "Small";
  968. SetPlayerAttachedObject(playerid, 9, 371, 1, -0.002, -0.140999, -0.01, 8.69999, 88.8, -8.79993, 1.11, 0.963);
  969. }
  970. case 2:
  971. {
  972. btype = "Medium";
  973. SetPlayerAttachedObject(playerid, 9, 371, 1, -0.002, -0.140999, -0.01, 8.69999, 88.8, -8.79993, 1.11, 0.963);
  974. }
  975. case 3:
  976. {
  977. btype = "Large";
  978. SetPlayerAttachedObject(playerid, 9, 3026, 1, -0.254999, -0.109, -0.022999, 10.6, -1.20002, 3.4, 1.265, 1.242, 1.062);
  979. }
  980. }
  981. format(string, sizeof(string), "You took your %s Backpack from your %s, use /bstore to store it.", btype, GetVehicleName(PlayerVehicleInfo[playerid][pvid][pvId]));
  982. SendClientMessageEx(playerid, COLOR_GREY, string);
  983. PlayerInfo[playerid][pBStoredV] = INVALID_PLAYER_VEHICLE_ID;
  984. PlayerInfo[playerid][pBEquipped] = 1;
  985. format(string, sizeof(string), "* %s has taken a backpack from their car trunk.", GetPlayerNameEx(playerid));
  986. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  987. }
  988. else if(PlayerInfo[playerid][pBStoredH] != INVALID_HOUSE_ID)
  989. {
  990. for(i = 0; i < MAX_HOUSES; i++)
  991. {
  992. if(HouseInfo[i][hSQLId] == PlayerInfo[playerid][pBStoredH])
  993. {
  994. pvid = i;
  995. break;
  996. }
  997. }
  998. if(IsPlayerInRangeOfPoint(playerid, 50, HouseInfo[pvid][hInteriorX], HouseInfo[pvid][hInteriorY], HouseInfo[pvid][hInteriorZ]) && GetPlayerVirtualWorld(playerid) == HouseInfo[pvid][hIntVW] && GetPlayerInterior(playerid) == HouseInfo[pvid][hIntIW])
  999. {
  1000. if(PlayerHoldingObject[playerid][9] != 0 || IsPlayerAttachedObjectSlotUsed(playerid, 9))
  1001. RemovePlayerAttachedObject(playerid, 9), PlayerHoldingObject[playerid][9] = 0;
  1002. switch(PlayerInfo[playerid][pBackpack])
  1003. {
  1004. case 1:
  1005. {
  1006. btype = "Small";
  1007. SetPlayerAttachedObject(playerid, 9, 371, 1, -0.002, -0.140999, -0.01, 8.69999, 88.8, -8.79993, 1.11, 0.963);
  1008. }
  1009. case 2:
  1010. {
  1011. btype = "Medium";
  1012. SetPlayerAttachedObject(playerid, 9, 371, 1, -0.002, -0.140999, -0.01, 8.69999, 88.8, -8.79993, 1.11, 0.963);
  1013. }
  1014. case 3:
  1015. {
  1016. btype = "Large";
  1017. SetPlayerAttachedObject(playerid, 9, 3026, 1, -0.254999, -0.109, -0.022999, 10.6, -1.20002, 3.4, 1.265, 1.242, 1.062);
  1018. }
  1019. }
  1020. format(string, sizeof(string), "You took your %s Backpack from your house, use /bstore to store it.", btype);
  1021. SendClientMessageEx(playerid, COLOR_GREY, string);
  1022. PlayerInfo[playerid][pBStoredH] = INVALID_HOUSE_ID;
  1023. PlayerInfo[playerid][pBEquipped] = 1;
  1024. format(string, sizeof(string), "* %s has taken a backpack from their house.", GetPlayerNameEx(playerid));
  1025. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  1026. return 1;
  1027. }
  1028. else return SendClientMessageEx(playerid, COLOR_GREY, "You need to be inside the house you have stored your backpack!");
  1029. }
  1030. }
  1031. else return SendClientMessageEx(playerid, COLOR_GREY, "You do not own a backpack(Use /miscshop to get one with credits)");
  1032. return 1;
  1033. }
  1034. CMD:bstore(playerid, params[])
  1035. {
  1036. if(PlayerInfo[playerid][pBackpack] > 0)
  1037. {
  1038. if(!PlayerInfo[playerid][pBEquipped]) return SendClientMessageEx(playerid, COLOR_GREY, "You are are not wearing your backpack, you can wear it with /bwear.");
  1039. if(!IsBackpackAvailable(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
  1040. if(GetPVarType(playerid, "IsInArena")) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now, you are in an arena!");
  1041. if(GetPVarInt(playerid, "EventToken") != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can't use this while you're in an event.");
  1042. if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this while being inside the vehicle!");
  1043. if(GetPVarInt(playerid, "EMSAttempt") != 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You can't use this command!");
  1044. new Float: Health;
  1045. GetHealth(playerid, Health);
  1046. if(Health < 50.0) return SendClientMessageEx(playerid,COLOR_GREY,"You cannot store a backpack in a house/car when your health lower than 80.");
  1047. new string[128], housecar[6];
  1048. if(sscanf(params, "s[6]", housecar)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bstore [house/car]");
  1049. if(strcmp(housecar, "car", true, strlen(housecar)) == 0)
  1050. {
  1051. new pvid = -1, Float: x, Float: y, Float: z;
  1052. for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++)
  1053. {
  1054. if(PlayerVehicleInfo[playerid][d][pvId] != INVALID_PLAYER_VEHICLE_ID) GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], x, y, z);
  1055. if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
  1056. {
  1057. pvid = d;
  1058. break;
  1059. }
  1060. }
  1061. if(pvid == -1) return SendClientMessageEx(playerid,COLOR_GREY,"You are not near any vehicle that you own.");
  1062. new engine,lights,alarm,doors,bonnet,boot,objective;
  1063. GetVehicleParamsEx(PlayerVehicleInfo[playerid][pvid][pvId],engine,lights,alarm,doors,bonnet,boot,objective);
  1064. if(boot == VEHICLE_PARAMS_OFF || boot == VEHICLE_PARAMS_UNSET) return SendClientMessageEx(playerid, COLOR_GRAD3, "You can't take/put stuff inside the trunk if it's closed!(/car trunk to open it)");
  1065. if(GetVehicleModel(PlayerVehicleInfo[playerid][pvid][pvId]) == 481 || GetVehicleModel(PlayerVehicleInfo[playerid][pvid][pvId]) == 510) return SendClientMessageEx(playerid,COLOR_GREY,"That vehicle doesn't have a trunk.");
  1066. new btype[7];
  1067. switch(PlayerInfo[playerid][pBackpack])
  1068. {
  1069. case 1: btype = "Small";
  1070. case 2: btype = "Medium";
  1071. case 3: btype = "Large";
  1072. }
  1073. format(string, sizeof(string), "You stored your %s Backpack in your %s, use /bwear to wear it.", btype, GetVehicleName(PlayerVehicleInfo[playerid][pvid][pvId]));
  1074. SendClientMessageEx(playerid, COLOR_GREY, string);
  1075. RemovePlayerAttachedObject(playerid, 9);
  1076. PlayerInfo[playerid][pBEquipped] = 0;
  1077. PlayerInfo[playerid][pBStoredV] = PlayerVehicleInfo[playerid][pvid][pvSlotId];
  1078. format(string, sizeof(string), "* %s has stored a backpack in the trunk of their car.", GetPlayerNameEx(playerid));
  1079. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  1080. format(string, sizeof(string), "[TRUNK] %s(%d) (%s) stored their %s backpack in [SQLID:%d][SlotID:%d][ModelID:%d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerIpEx(playerid), btype, PlayerVehicleInfo[playerid][pvid][pvSlotId], pvid, PlayerVehicleInfo[playerid][pvid][pvModelId]);
  1081. Log("logs/backpack.log", string);
  1082. }
  1083. else if(strcmp(housecar, "house", true, strlen(housecar)) == 0)
  1084. {
  1085. if(Homes[playerid] > 0)
  1086. {
  1087. new hid = -1;
  1088. for(new i; i < MAX_HOUSES; i++)
  1089. {
  1090. if(GetPlayerSQLId(playerid) == HouseInfo[i][hOwnerID] && IsPlayerInRangeOfPoint(playerid, 50, HouseInfo[i][hInteriorX], HouseInfo[i][hInteriorY], HouseInfo[i][hInteriorZ]) && GetPlayerVirtualWorld(playerid) == HouseInfo[i][hIntVW] && GetPlayerInterior(playerid) == HouseInfo[i][hIntIW])
  1091. {
  1092. hid = i;
  1093. break;
  1094. }
  1095. }
  1096. if(hid == -1) return SendClientMessageEx(playerid, COLOR_GREY, "You're not in a house that you own.");
  1097. new btype[7];
  1098. switch(PlayerInfo[playerid][pBackpack])
  1099. {
  1100. case 1: btype = "Small";
  1101. case 2: btype = "Medium";
  1102. case 3: btype = "Large";
  1103. }
  1104. format(string, sizeof(string), "You stored your %s Backpack in your house, use /bwear to wear it.", btype);
  1105. SendClientMessageEx(playerid, COLOR_GREY, string);
  1106. RemovePlayerAttachedObject(playerid, 9);
  1107. PlayerInfo[playerid][pBEquipped] = 0;
  1108. PlayerInfo[playerid][pBStoredH] = HouseInfo[hid][hSQLId];
  1109. format(string, sizeof(string), "* %s has stored a backpack in their house.", GetPlayerNameEx(playerid));
  1110. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  1111. format(string, sizeof(string), "[HOUSE] %s(%d) (%s) stored his %s backpack in [HouseID:%d]", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerIpEx(playerid), btype, hid);
  1112. Log("logs/backpack.log", string);
  1113. }
  1114. else return SendClientMessageEx(playerid, COLOR_GREY, "You don't own a house.");
  1115. }
  1116. else return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bstore [house/car]");
  1117. }
  1118. else return SendClientMessageEx(playerid, COLOR_GREY, "You do not own a backpack(Use /miscshop to get one with credits)");
  1119. return 1;
  1120. }
  1121. CMD:bopen(playerid, params[])
  1122. {
  1123. if(PlayerInfo[playerid][pBackpack] > 0)
  1124. {
  1125. if(dr_iPlayerTimeStamp[playerid] > gettime() - 60) return SendClientMessageEx(playerid, COLOR_GRAD1, "You have been injured in the last minute");
  1126. if(!IsBackpackAvailable(playerid)) {
  1127. SendClientMessageEx(playerid, COLOR_GREY, "You cannot use your backpack at this moment.");
  1128. return 1;
  1129. }
  1130. new string[122];
  1131. if(GetPVarInt(playerid, "BackpackDisabled") > 0)
  1132. {
  1133. format(string, sizeof(string), "You have recently taken damage during the backpack menu, your backpack is disabled for %d second(s)", GetPVarInt(playerid, "BackpackDisabled"));
  1134. SendClientMessageEx(playerid, COLOR_GREY, string);
  1135. return 1;
  1136. }
  1137. ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0, 1);
  1138. format(string, sizeof(string), "{FF8000}** {C2A2DA}%s lays down and opens a backpack.", GetPlayerNameEx(playerid));
  1139. SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 15.0, 5000);
  1140. // ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  1141. SetPVarInt(playerid, "BackpackProt", 1);
  1142. SetPVarInt(playerid, "BackpackOpen", 1);
  1143. ShowBackpackMenu(playerid, DIALOG_OBACKPACK, "");
  1144. }
  1145. return 1;
  1146. }
  1147. CMD:backpackhelp(playerid, params[])
  1148. {
  1149. SetPVarInt(playerid, "HelpResultCat0", 2);
  1150. Help_ListCat(playerid, DIALOG_HELPCATOTHER1);
  1151. return 1;
  1152. }
  1153. CMD:obackpackhelp(playerid, params[]) {
  1154. szMiscArray[0] = 0;
  1155. format(szMiscArray, sizeof(szMiscArray), "Item: Small Backpack\nFood Storage: 1 Meals\nNarcotics Storage: 40 Grams\nFirearms Storage: 2 Weapons(Handguns only)\nCost: {FFD700}%s{A9C4E4}\n\n", number_format(ShopItems[36][sItemPrice]));
  1156. format(szMiscArray, sizeof(szMiscArray), "%sItem: Medium Backpack\nFood Storage: 4 Meals\nNarcotics Storage: 100 Grams\nFirearms Storage: 3 Weapons(2 Handguns & 1 Primary)\nCost: {FFD700}%s{A9C4E4}\n\n", szMiscArray, number_format(ShopItems[37][sItemPrice]));
  1157. format(szMiscArray, sizeof(szMiscArray), "%sItem: Large Backpack\nFood Storage: 5 Meals\nNarcotics Storage: 250 Grams\nFirearms Storage: 5 Weapons(2 Handguns & 3 Primary)\nCost: {FFD700}%s{A9C4E4}\n\n\n", szMiscArray, number_format(ShopItems[38][sItemPrice]));
  1158. format(szMiscArray, sizeof(szMiscArray), "%sCommands available: /bstore /bwear /bopen /sellbackpack /drop backpack (/miscshop to buy one with credits)", szMiscArray);
  1159. ShowPlayerDialogEx(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Backpack Information", szMiscArray, "Exit", "");
  1160. return 1;
  1161. }