backpack.inc 109 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064
  1. /*
  2. (Unique) Dynamic Backpack System by ToiletDuck (Eubie Jay Hernandez Clemente)
  3. Date Of Sold: September 29, 2017
  4. System License: td1237263jxqh
  5. Date of Implementation: to be update.
  6. Do not remove this License/Credits the System will be Automatic Delete with no trace.
  7. */
  8. #include <YSI\y_hooks>
  9. /* ------------------ Defines ---------------- */
  10. #define MAX_BACKPACKS 2000
  11. #define MAX_STOREGUN 5 /* Array starts on 0 */
  12. #define DIALOG_EDITMAINBACKPACK 6000
  13. #define DIALOG_EDITITEMS 6001
  14. #define DIALOG_BACKPACKMENU 6005 // For Player Dialog /backpack
  15. #define DIALOG_ACTIONBACKPACKMENU 6006
  16. #define DIALOG_PUTAKEITEMS 6007
  17. /* Limit Item Types */
  18. #define LIMIT_CASH 0
  19. #define LIMIT_POT 1
  20. #define LIMIT_CRACK 2
  21. #define LIMIT_MATS 3
  22. #define LIMIT_GUN 4
  23. #define LIMIT_AMMO 5
  24. /* Item Types */
  25. #define ITEM_CASH 1
  26. #define ITEM_POT 2
  27. #define ITEM_CRACK 3
  28. #define ITEM_MATS 4
  29. #define ITEM_GUNS 5
  30. /* Edit Types */
  31. #define TYPE_CASH 1
  32. #define TYPE_POT 2
  33. #define TYPE_CRACK 3
  34. #define TYPE_MATS 4
  35. #define TYPE_GUN1 5
  36. #define TYPE_GUN2 6
  37. #define TYPE_GUN3 7
  38. #define TYPE_GUN4 8
  39. #define TYPE_GUN5 9
  40. /* ------------------ Enum ------------------ */
  41. enum backpackinfo
  42. {
  43. bBackpackOwner,
  44. bBackpackSize,
  45. bHouseStored,
  46. bVehicleStored,
  47. bCash,
  48. bPot,
  49. bCrack,
  50. bMats,
  51. bGun[MAX_STOREGUN]
  52. };
  53. /* ----------------- Variables --------------- */
  54. new itemtype[][] = {"Nothing", "Cash", "Pot", "Crack", "Material","Weapon"};
  55. new storagetype[][] = { "None", "Small Backpack", "Medium Backpack", "Large Backpack"};
  56. // For Backpack System should move to defines later
  57. //Cash, Pot, Crack, Mats, Weapons
  58. new sbackpacklimit[] = { 3000000, 70, 70, 100000, 3};
  59. new mbackpacklimit[] = { 5000000, 100, 100, 200000, 5};
  60. new lbackpacklimit[] = { 8000000, 150, 150, 300000, 8};
  61. new BackpackInfo[MAX_BACKPACKS][backpackinfo];
  62. new backpackid[MAX_PLAYERS];
  63. /* ----------------- Functions --------------- */
  64. stock SetPlayerAttachedObjectEx(playerid, idx, model, bonex, Float:OffsetX = 0.0, Float:OffsetY = 0.0, Float:OffsetZ = 0.0, Float:RotX = 0.0, Float:RotY = 0.0, Float:RotZ = 0.0, Float:ScaleX = 1.0, Float:ScaleY = 1.0, Float:ScaleZ = 1.0, mat1 = 0, mat2 = 0)
  65. {
  66. if(idx < 9) {
  67. SetPlayerAttachedObject(playerid, idx, model, bonex, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:RotX, Float:RotY, Float:RotZ, Float:ScaleX, Float:ScaleY, Float:ScaleZ, mat1, mat2);
  68. }
  69. }
  70. stock RemovePlayerAttachedObjectEx(playerid, idx) {
  71. if(idx < 9) {
  72. RemovePlayerAttachedObject(playerid, idx);
  73. }
  74. }
  75. stock GetBackpackStored(playerid) // 1 = HOUSE STORED | 2 = Vehicle Stored
  76. {
  77. if(PlayerHasBackpack(playerid))
  78. {
  79. new bpID = GetPlayerBackpackID(playerid);
  80. if(BackpackInfo[bpID][bHouseStored] == 1) return 1;
  81. else if(BackpackInfo[bpID][bVehicleStored] == 1) return 2;
  82. }
  83. return 0;
  84. }
  85. stock PlayerHasBackpack(playerid) {
  86. if(GetPlayerBackpackID(playerid) != MAX_BACKPACKS+1) return 1;
  87. else return 0;
  88. }
  89. stock GetPlayerBackpackID(playerid) return backpackid[playerid];
  90. stock LoadPlayerBackpack(playerid) {
  91. for(new i; i < MAX_BACKPACKS; i++)
  92. {
  93. if(BackpackInfo[i][bBackpackOwner] != -1)
  94. {
  95. if(BackpackInfo[i][bBackpackOwner] == GetPlayerSQLId(playerid)) {
  96. if(BackpackInfo[i][bHouseStored] != 1 && BackpackInfo[i][bVehicleStored] != 1)
  97. {
  98. if(IsPlayerAttachedObjectSlotUsed(playerid, 9)) RemovePlayerAttachedObject(playerid, 9);
  99. SetPlayerAttachedObject(playerid, 9, 3026, 1, -0.15, -0.1, 0, 0, 0, 0, 1, 1, 1);
  100. }
  101. backpackid[playerid] = i;
  102. i = MAX_BACKPACKS+1;
  103. }
  104. }
  105. }
  106. return 1;
  107. }
  108. stock GetPlayerStorageType(playerid) {
  109. new id = GetPlayerBackpackID(playerid);
  110. new string[32];
  111. format(string,sizeof(string), "%s",storagetype[BackpackInfo[id][bBackpackSize]]);
  112. return string;
  113. }
  114. stock BackpackLimit(size,type) {
  115. switch(size) {
  116. case 1:{
  117. switch(type){
  118. case LIMIT_CASH: return sbackpacklimit[LIMIT_CASH];
  119. case LIMIT_POT: return sbackpacklimit[LIMIT_POT];
  120. case LIMIT_CRACK: return sbackpacklimit[LIMIT_CRACK];
  121. case LIMIT_MATS: return sbackpacklimit[LIMIT_MATS];
  122. case LIMIT_GUN: return sbackpacklimit[LIMIT_GUN];
  123. }
  124. }
  125. case 2:{
  126. switch(type){
  127. case LIMIT_CASH: return mbackpacklimit[LIMIT_CASH];
  128. case LIMIT_POT: return mbackpacklimit[LIMIT_POT];
  129. case LIMIT_CRACK: return mbackpacklimit[LIMIT_CRACK];
  130. case LIMIT_MATS: return mbackpacklimit[LIMIT_MATS];
  131. case LIMIT_GUN: return mbackpacklimit[LIMIT_GUN];
  132. }
  133. }
  134. case 3: {
  135. switch(type){
  136. case LIMIT_CASH: return lbackpacklimit[LIMIT_CASH];
  137. case LIMIT_POT: return lbackpacklimit[LIMIT_POT];
  138. case LIMIT_CRACK: return lbackpacklimit[LIMIT_CRACK];
  139. case LIMIT_MATS: return lbackpacklimit[LIMIT_MATS];
  140. case LIMIT_GUN: return lbackpacklimit[LIMIT_GUN];
  141. }
  142. }
  143. }
  144. return -1;
  145. }
  146. stock GetBackpackSize(id) {
  147. new string[64];
  148. switch(BackpackInfo[id][bBackpackSize]) {
  149. case 1: format(string,sizeof(string), "{FFFFFF}Small Backpack{FFFFFF}");
  150. case 2: format(string,sizeof(string), "{FF9500}Medium Backpack{FFFFFF}");
  151. case 3: format(string,sizeof(string), "{FF00EA}Large Backpack{FFFFFF}");
  152. }
  153. return string;
  154. }
  155. stock IsRoleplayWeapon(weaponid) {
  156. switch(weaponid) {
  157. case 1..3,5..8,10..16,22..34: return 1;
  158. }
  159. return 0;
  160. }
  161. stock ShowBackpackActionChoice(playerid) {
  162. switch(GetPVarInt(playerid, "Listitem_Backpack")) {
  163. case 0: ShowPlayerDialog(playerid, DIALOG_ACTIONBACKPACKMENU, DIALOG_STYLE_LIST, "Backpack Action", "Put Cash\nTake Cash", "Choose", "Back");
  164. case 1: ShowPlayerDialog(playerid, DIALOG_ACTIONBACKPACKMENU, DIALOG_STYLE_LIST, "Backpack Action", "Put Pots\nTake Pots", "Choose", "Back");
  165. case 2: ShowPlayerDialog(playerid, DIALOG_ACTIONBACKPACKMENU, DIALOG_STYLE_LIST, "Backpack Action", "Put Cracks\nTake Cracks", "Choose", "Back");
  166. case 3: ShowPlayerDialog(playerid, DIALOG_ACTIONBACKPACKMENU, DIALOG_STYLE_LIST, "Backpack Action", "Put Materials\nTake Materials", "Choose", "Back");
  167. case 4: ShowPlayerDialog(playerid, DIALOG_ACTIONBACKPACKMENU, DIALOG_STYLE_LIST, "Backpack Action", "Put Weapon to Gun1\nTake Weapon in Gun1", "Choose", "Back");
  168. case 5: ShowPlayerDialog(playerid, DIALOG_ACTIONBACKPACKMENU, DIALOG_STYLE_LIST, "Backpack Action", "Put Weapon to Gun2\nTake Weapon in Gun2", "Choose", "Back");
  169. case 6: ShowPlayerDialog(playerid, DIALOG_ACTIONBACKPACKMENU, DIALOG_STYLE_LIST, "Backpack Action", "Put Weapon to Gun3\nTake Weapon in Gun3", "Choose", "Back");
  170. case 7: ShowPlayerDialog(playerid, DIALOG_ACTIONBACKPACKMENU, DIALOG_STYLE_LIST, "Backpack Action", "Put Weapon to Gun4\nTake Weapon in Gun4", "Choose", "Back");
  171. case 8: ShowPlayerDialog(playerid, DIALOG_ACTIONBACKPACKMENU, DIALOG_STYLE_LIST, "Backpack Action", "Put Weapon to Gun5\nTake Weapon in Gun5", "Choose", "Back");
  172. }
  173. return 1;
  174. }
  175. stock ShowPlayerBackpack(playerid)
  176. {
  177. new stringex[2000], index = GetPlayerBackpackID(playerid),title[64];
  178. if(!PlayerHasBackpack(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You don't have any Backpack");
  179. format(stringex,sizeof(stringex),
  180. "Cash ($%s) \n\
  181. Pots (%sg) \n\
  182. Cracks (%sg) \n\
  183. Mats (%s)\n",
  184. number_format(BackpackInfo[index][bCash]),
  185. number_format(BackpackInfo[index][bPot]),
  186. number_format(BackpackInfo[index][bCrack]),
  187. number_format(BackpackInfo[index][bMats])
  188. );
  189. if(BackpackInfo[index][bBackpackSize] == 1) {
  190. format(stringex,sizeof(stringex),
  191. "%s\
  192. Gun (%s) \n\
  193. Gun (%s)",
  194. stringex,
  195. GetWeaponNameEx(BackpackInfo[index][bGun][0]),
  196. GetWeaponNameEx(BackpackInfo[index][bGun][1])
  197. );
  198. }
  199. else if(BackpackInfo[index][bBackpackSize] == 2) {
  200. format(stringex,sizeof(stringex),
  201. "%s\
  202. Gun (%s) \n\
  203. Gun (%s) \n\
  204. Gun (%s)",
  205. stringex,
  206. GetWeaponNameEx(BackpackInfo[index][bGun][0]),
  207. GetWeaponNameEx(BackpackInfo[index][bGun][1]),
  208. GetWeaponNameEx(BackpackInfo[index][bGun][3])
  209. );
  210. }
  211. else if(BackpackInfo[index][bBackpackSize] == 3) {
  212. format(stringex,sizeof(stringex),
  213. "%s\
  214. Gun (%s) \n\
  215. Gun (%s) \n\
  216. Gun (%s) \n\
  217. Gun (%s) \n\
  218. Gun (%s)",
  219. stringex,
  220. GetWeaponNameEx(BackpackInfo[index][bGun][0]),
  221. GetWeaponNameEx(BackpackInfo[index][bGun][1]),
  222. GetWeaponNameEx(BackpackInfo[index][bGun][2]),
  223. GetWeaponNameEx(BackpackInfo[index][bGun][3]),
  224. GetWeaponNameEx(BackpackInfo[index][bGun][4])
  225. );
  226. }
  227. format(title,sizeof(title), "Content of my %s", GetBackpackSize(index));
  228. ShowPlayerDialog(playerid, DIALOG_BACKPACKMENU, DIALOG_STYLE_LIST, title, stringex, "Choose", "Close");
  229. return 1;
  230. }
  231. stock ShowEditBackpackDialog(playerid, index) {
  232. new stringex[2000];
  233. format(stringex,sizeof(stringex),
  234. "Cash ($%s) \n\
  235. Pots (%sg) \n\
  236. Cracks (%sg) \n\
  237. Mats (%s)\n",
  238. number_format(BackpackInfo[index][bCash]),
  239. number_format(BackpackInfo[index][bPot]),
  240. number_format(BackpackInfo[index][bCrack]),
  241. number_format(BackpackInfo[index][bMats])
  242. );
  243. if(BackpackInfo[index][bBackpackSize] == 1) {
  244. format(stringex,sizeof(stringex),
  245. "%s\
  246. Gun (%s) \n\
  247. Gun (%s)",
  248. stringex,
  249. GetWeaponNameEx(BackpackInfo[index][bGun][0]),
  250. GetWeaponNameEx(BackpackInfo[index][bGun][1])
  251. );
  252. }
  253. else if(BackpackInfo[index][bBackpackSize] == 2) {
  254. format(stringex,sizeof(stringex),
  255. "%s\
  256. Gun (%s) \n\
  257. Gun (%s) \n\
  258. Gun (%s)",
  259. stringex,
  260. GetWeaponNameEx(BackpackInfo[index][bGun][0]),
  261. GetWeaponNameEx(BackpackInfo[index][bGun][1]),
  262. GetWeaponNameEx(BackpackInfo[index][bGun][3])
  263. );
  264. }
  265. else if(BackpackInfo[index][bBackpackSize] == 3) {
  266. format(stringex,sizeof(stringex),
  267. "%s\
  268. Gun (%s) \n\
  269. Gun (%s) \n\
  270. Gun (%s) \n\
  271. Gun (%s) \n\
  272. Gun (%s)",
  273. stringex,
  274. GetWeaponNameEx(BackpackInfo[index][bGun][0]),
  275. GetWeaponNameEx(BackpackInfo[index][bGun][1]),
  276. GetWeaponNameEx(BackpackInfo[index][bGun][2]),
  277. GetWeaponNameEx(BackpackInfo[index][bGun][3]),
  278. GetWeaponNameEx(BackpackInfo[index][bGun][4])
  279. );
  280. }
  281. new title[64];
  282. format(title,sizeof(title), "Player (%s) - %s Information", GetPlayerRPName(GetPVarInt(playerid, "GetPlayerID")), GetPlayerStorageType(GetPVarInt(playerid, "GetPlayerID")));
  283. ShowPlayerDialog(playerid, DIALOG_EDITMAINBACKPACK, DIALOG_STYLE_LIST, title, stringex, "Edit", "Close");
  284. SetPVarInt(playerid, "BackpackID", index);
  285. return 1;
  286. }
  287. /* ----------------- MYSQL SAVING/LOADING --------------- */
  288. // LoadBackpacks(playerid)
  289. // Description: Load the backpacks of the server
  290. stock LoadBackpacks() {
  291. for(new i = 0; i < MAX_BACKPACKS; i++) {
  292. BackpackInfo[i][bBackpackOwner] = -1;
  293. BackpackInfo[i][bBackpackSize] = 0;
  294. BackpackInfo[i][bHouseStored] = 0;
  295. BackpackInfo[i][bVehicleStored] = 0;
  296. BackpackInfo[i][bCash] = 0;
  297. BackpackInfo[i][bPot] = 0;
  298. BackpackInfo[i][bCrack] = 0;
  299. BackpackInfo[i][bMats] = 0;
  300. for(new weaponid; weaponid<MAX_STOREGUN; weaponid++) {
  301. BackpackInfo[i][bGun][weaponid] = 0;
  302. }
  303. }
  304. mysql_format(connectionID, "SELECT * FROM `playerbackpack`", true, "OnLoadBackpacks", "i", SENDDATA_THREAD);
  305. }
  306. stock SaveBackpack(i) {
  307. if(i == MAX_BACKPACKS+1) return 1;
  308. new string[2000];
  309. format(string, sizeof(string), "UPDATE `playerbackpack` SET \
  310. `BackpackOwner`=%d, \
  311. `BackpackSize`=%d, \
  312. `HouseStored`=%d, \
  313. `VehicleStored`=%d, \
  314. `Cash`=%d, \
  315. `Pot`=%d, \
  316. `Crack`=%d, \
  317. `Mats`=%d,",
  318. BackpackInfo[i][bBackpackOwner],
  319. BackpackInfo[i][bBackpackSize],
  320. BackpackInfo[i][bHouseStored],
  321. BackpackInfo[i][bVehicleStored],
  322. BackpackInfo[i][bCash],
  323. BackpackInfo[i][bPot],
  324. BackpackInfo[i][bCrack],
  325. BackpackInfo[i][bMats]
  326. );
  327. for(new weaponid; weaponid<MAX_STOREGUN; weaponid++) {
  328. if(weaponid == MAX_STOREGUN-1) {
  329. format(string, sizeof(string), "%s \
  330. `Gun%d`=%d WHERE `ID` = %d",
  331. string,
  332. weaponid,
  333. BackpackInfo[i][bGun][weaponid],
  334. i+1
  335. );
  336. }
  337. else {
  338. format(string, sizeof(string), "%s \
  339. `Gun%d`=%d,",
  340. string,
  341. weaponid,
  342. BackpackInfo[i][bGun][weaponid]
  343. );
  344. }
  345. }
  346. mysql_format(connectionID, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  347. return 1;
  348. }
  349. forward OnLoadBackpacks();
  350. public OnLoadBackpacks()
  351. {
  352. new i, rows, fields, szField[24], tmp[128];
  353. cache_get_data(rows, fields, MainPipeline);
  354. while(i < rows)
  355. {
  356. cache_get_field_content(i, "BackpackOwner", tmp, MainPipeline); BackpackInfo[i][bBackpackOwner] = strval(tmp);
  357. cache_get_field_content(i, "BackpackSize", tmp, MainPipeline); BackpackInfo[i][bBackpackSize] = strval(tmp);
  358. cache_get_field_content(i, "HouseStored", tmp, MainPipeline); BackpackInfo[i][bCash] = strval(tmp);
  359. cache_get_field_content(i, "VehicleStored", tmp, MainPipeline); BackpackInfo[i][bCash] = strval(tmp);
  360. cache_get_field_content(i, "Cash", tmp, MainPipeline); BackpackInfo[i][bCash] = strval(tmp);
  361. cache_get_field_content(i, "Pot", tmp, MainPipeline); BackpackInfo[i][bPot] = strval(tmp);
  362. cache_get_field_content(i, "Crack", tmp, MainPipeline); BackpackInfo[i][bCrack] = strval(tmp);
  363. cache_get_field_content(i, "Mats", tmp, MainPipeline); BackpackInfo[i][bMats] = strval(tmp);
  364. for(new weaponid; weaponid<MAX_STOREGUN; weaponid++) {
  365. format(szField, sizeof(szField), "Gun%d", weaponid);
  366. cache_get_field_content(i, szField, tmp, MainPipeline);
  367. BackpackInfo[i][bGun][weaponid] = strval(tmp);
  368. }
  369. i++;
  370. }
  371. if(i > 0) printf("[Backpacks] %d Backpacks rehashed/loaded.", i);
  372. else printf("[Backpacks] Failed to load any Backpacks.");
  373. return 1;
  374. }
  375. forward InsertBackpack(index, owner);
  376. public InsertBackpack(index, owner)
  377. {
  378. new rows, fields,query[200];
  379. cache_get_data(rows, fields, MainPipeline);
  380. if(rows) SaveBackpack(index);
  381. else {
  382. format(query,sizeof(query), "INSERT INTO `playerbackpack` (`BackpackOwner`) VALUES ('%d')", owner);
  383. mysql_format(connectionID, query, false, "SENDDATA_THREAD", "i", SENDDATA_THREAD), SaveBackpack(index);
  384. }
  385. return 1;
  386. }
  387. CMD:bphelp(playerid)
  388. {
  389. SendClientMessage(playerid, COLOR_WHITE, ""); // you can do it hahah
  390. return 1;
  391. }
  392. /* ----------------- COMMANDS --------------- */
  393. CMD:sellmybackpack(playerid, params[])
  394. {
  395. new giveplayerid, string[128], amount, bpID = GetPlayerBackpackID(playerid);
  396. if(!PlayerHasBackpack(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, " You dont have any backpack to sell!");
  397. new bpstored = GetBackpackStored(playerid);
  398. if(bpstored == 1) return SendClientMessageEx(playerid, COLOR_GREY, " You don't have your backpack with you!You just stored it in your house.");
  399. else if(bpstored == 2) return SendClientMessageEx(playerid, COLOR_GREY, " You don't have your backpack with you! You just stored it in your vehicle trunk.");
  400. if(PlayerInfo[playerid][pAdmin] >= 2) return SendClientMessageEx(playerid, COLOR_GREY, "Administrators are not allowed to sell their backpack!");
  401. //if(PlayerInfo[playerid][pConnectHours] < 10) return SendClientMessageEx(playerid, COLOR_GREY, "You must play 10 hours before you can sell your Backpack");
  402. if(sscanf(params ,"ud", giveplayerid, amount)) return SendClientMessageEx(playerid, COLOR_GREY," USAGE: /sellmybackpack [giveplayerid] [price]");
  403. if(giveplayerid == playerid) return SendClientMessageEx(playerid, COLOR_GREY, "What was that? Ofcourse you can't sell your backpack to yourself");
  404. if(!IsPlayerConnected(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, " Invalid Player ID !");
  405. if(PlayerHasBackpack(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, " That player has already a Backpack!");
  406. new bpstored2 = GetBackpackStored(giveplayerid);
  407. if(bpstored2 == 1) return SendClientMessageEx(playerid, COLOR_GREY, "That player has already his backpack stored in his/her house!");
  408. else if(bpstored2 == 2) return SendClientMessageEx(playerid, COLOR_GREY, "That player has already his backpack stored in his/her vehicle trunk!");
  409. if(1 < amount > 10000000) return SendClientMessageEx(playerid, COLOR_GREY, "Price must not a negative value or over $10,000,000!");
  410. if(GetPlayerCash(giveplayerid) < amount) return SendClientMessageEx(playerid, COLOR_GREY, " That player dont have enought cash to buy your backpack!");
  411. if(BackpackInfo[bpID][bCash] != 0 && !GetPVarInt(playerid, "SellBackpackConfirm") || BackpackInfo[bpID][bPot] != 0 && !GetPVarInt(playerid, "SellBackpackConfirm") || BackpackInfo[bpID][bCrack] != 0 && !GetPVarInt(playerid, "SellBackpackConfirm") || BackpackInfo[bpID][bMats] != 0 && !GetPVarInt(playerid, "SellBackpackConfirm"))
  412. {
  413. ShowPlayerDialog(playerid, 0 , DIALOG_STYLE_MSGBOX, "Backpack Notice", "Are you sure do you want to sell your Backpack when you still have items on it?\nIf Yes kindly re-enter the command!", "Okay", "");
  414. SetPVarInt(playerid, "SellBackpackConfirm", 1);
  415. return 1;
  416. }
  417. DeletePVar(playerid, "SellBackpackConfirm");
  418. format(string ,sizeof(string), "* Player %s has offered you to buy his %s for $%s (/acceptbackpack) to buy or (/denybackpack) if not", GetPlayerRPName(playerid) , GetPlayerStorageType(playerid), number_format(amount));
  419. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE , string);
  420. format(string ,sizeof(string) ,"* You have offered %s to buy your %s for $%s", GetPlayerRPName(giveplayerid) ,GetPlayerStorageType(playerid) , number_format(amount));
  421. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  422. SetPVarInt(giveplayerid, "BackpackSeller", playerid);
  423. SetPVarInt(giveplayerid, "BackpackPrice", amount);
  424. SetPVarInt(giveplayerid, "BackpackID", bpID);
  425. return 1;
  426. }
  427. CMD:acceptbackpack(playerid, params[])
  428. {
  429. if(PlayerInfo[playerid][pAdmin] >= 2 && strcmp(GetPlayerRPName(playerid), "Astral", false) != 0) return SendClientMessageEx(playerid, COLOR_GREY, "Administrators are not allowed to use this command!");
  430. if(!GetPVarType(playerid, "BackpackSeller")) return SendClientMessageEx(playerid, COLOR_GREY, "No one offerec you to buy a Backpack!");
  431. new sellerid = GetPVarInt(playerid, "BackpackSeller"), price = GetPVarInt(playerid, "BackpackPrice"), index = GetPVarInt(playerid, "BackpackID");
  432. if(PlayerHasBackpack(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You already have a Backpack!");
  433. if(!IsPlayerConnected(sellerid)) return SendClientMessageEx(playerid, COLOR_GREY, "The Player offered you a Backpack is isn't connected!");
  434. if(!PlayerHasBackpack(sellerid)) return SendClientMessageEx(playerid, COLOR_GREY, "The Seller doesn't have any Backpack to sell!");
  435. if(price > GetPlayerCash(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You dont have enough cash to buy this Backpack");
  436. if(!GetPVarType(playerid, "BuyBackpackConfirm")) return SetPVarInt(playerid, "BuyBackpackConfirm", 1), ShowPlayerDialog(playerid, 0 , DIALOG_STYLE_MSGBOX, "Backpack Notice!", "Are you sure do you want to buy this backpack? If Yes kindly re-enter the command", "Okay", "");
  437. DeletePVar(playerid, "BuyBackpackConfirm");
  438. new string[128];
  439. format(string ,sizeof(string), "* Player %s has successfuly bought your %s for $%s", GetPlayerRPName(playerid) , GetPlayerStorageType(sellerid), number_format(price));
  440. SendClientMessageEx(sellerid, COLOR_LIGHTBLUE, string);
  441. format(string, sizeof(string), "* You have successfuly bought %s's %s for $%s", GetPlayerRPName(sellerid), GetPlayerStorageType(sellerid) , number_format(price));
  442. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  443. GivePlayerCash(playerid, -price);
  444. GivePlayerCash(sellerid, price);
  445. BackpackInfo[index][bBackpackOwner] = GetPlayerSQLId(playerid);
  446. if(IsPlayerAttachedObjectSlotUsed(sellerid, 9)) RemovePlayerAttachedObject(sellerid, 9);
  447. if(IsPlayerAttachedObjectSlotUsed(playerid, 9)) RemovePlayerAttachedObject(playerid, 9);
  448. switch(BackpackInfo[index][bBackpackSize]) {
  449. case 1: SetPlayerAttachedObject(playerid, 9, 3026, 1, -0.15, -0.1, 0, 0, 0, 0, 1, 1, 1, 0xFFFFFFFF, 0xFFFFFFFF);
  450. case 2: SetPlayerAttachedObject(playerid, 9, 3026, 1, -0.15, -0.1, 0, 0, 0, 0, 1, 1, 1, 0xFFFF9500, 0xFFFF9500);
  451. case 3: SetPlayerAttachedObject(playerid, 9, 3026, 1, -0.15, -0.1, 0, 0, 0, 0, 1, 1, 1, 0xFFFF00EA, 0xFFFF00EA);
  452. }
  453. backpackid[sellerid] = MAX_BACKPACKS+1;
  454. backpackid[playerid] = index;
  455. OnPlayerStatsUpdate(sellerid);
  456. OnPlayerStatsUpdate(playerid);
  457. DeletePVar(playerid, "BackpackSeller");
  458. DeletePVar(playerid, "BackpackPrice");
  459. DeletePVar(playerid, "BackpackID");
  460. return 1;
  461. }
  462. CMD:denybackpack(playerid, params[])
  463. {
  464. new string[128], sellerid = GetPVarInt(playerid, "BackpackSeller"), price = GetPVarInt(playerid, "BackpackPrice");
  465. if(!GetPVarType(playerid, "BackpackSeller")) return SendClientMessageEx(playerid, COLOR_GREY, "No one offerec you to buy a Backpack!");
  466. format(string ,sizeof(string), "* Player %s has turn down your offer to buy your %s for $%s", GetPlayerRPName(playerid) , GetPlayerStorageType(sellerid), number_format(price));
  467. SendClientMessageEx(sellerid, COLOR_LIGHTBLUE, string);
  468. format(string, sizeof(string), "* You have turn down the offer of %s's %s for $%s", GetPlayerRPName(sellerid), GetPlayerStorageType(sellerid) , number_format(price));
  469. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  470. DeletePVar(playerid, "BackpackSeller");
  471. DeletePVar(playerid, "BackpackPrice");
  472. DeletePVar(playerid, "BackpackID");
  473. return 1;
  474. }
  475. CMD:removebackpack(playerid, params[])
  476. {
  477. if(PlayerInfo[playerid][pAdmin] < 100001 && strcmp(GetPlayerRPName(playerid), "Astral", false) != 0)
  478. return SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
  479. new giveplayerid, string[128];
  480. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /removebackpack [playerid]");
  481. if(!PlayerHasBackpack(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "That player doesn't have any Backpack!");
  482. format(string ,sizeof(string), "* Admin %s has removed your %s and all items except weapons has been added to your stats", GetPlayerRPName(playerid), GetPlayerStorageType(giveplayerid));
  483. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
  484. format(string ,sizeof(string), "* You have removed Player %s's %s and all items except gun in the Backpack has been added to their stats", GetPlayerRPName(giveplayerid), GetPlayerStorageType(giveplayerid));
  485. SendClientMessageEx(playerid, COLOR_WHITE, string);
  486. new bpID = GetPlayerBackpackID(giveplayerid);
  487. if(BackpackInfo[bpID][bCash] != 0) GivePlayerCash(giveplayerid, BackpackInfo[bpID][bCash]);
  488. if(BackpackInfo[bpID][bPot] != 0) PlayerInfo[giveplayerid][pWeed] += BackpackInfo[bpID][bPot];
  489. if(BackpackInfo[bpID][bCrack] != 0) PlayerInfo[giveplayerid][pCocaine] += BackpackInfo[bpID][bCrack];
  490. if(BackpackInfo[bpID][bMats] != 0) PlayerInfo[giveplayerid][pMaterials] += BackpackInfo[bpID][bMats];
  491. BackpackInfo[bpID][bCash] = 0;
  492. BackpackInfo[bpID][bPot] = 0;
  493. BackpackInfo[bpID][bCrack] = 0;
  494. BackpackInfo[bpID][bMats] = 0;
  495. BackpackInfo[bpID][bGun][0] = 0;
  496. BackpackInfo[bpID][bGun][1] = 0;
  497. BackpackInfo[bpID][bGun][2] = 0;
  498. BackpackInfo[bpID][bGun][3] = 0;
  499. BackpackInfo[bpID][bGun][4] = 0;
  500. BackpackInfo[bpID][bBackpackOwner] = -1;
  501. OnPlayerStatsUpdate(giveplayerid);
  502. if(IsPlayerAttachedObjectSlotUsed(giveplayerid, 9)) RemovePlayerAttachedObject(giveplayerid, 9);
  503. backpackid[giveplayerid] = MAX_BACKPACKS+1;
  504. return 1;
  505. }
  506. CMD:storebp(playerid, params[]) return cmd_storebackpack(playerid, params);
  507. CMD:storebackpack(playerid, params[])
  508. {
  509. if(!PlayerHasBackpack(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You dont have any Backpack!");
  510. new bpID = GetPlayerBackpackID(playerid), string[128], bpstored = GetBackpackStored(playerid);
  511. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, " USAGE: /storebackpack [house/trunk] ");
  512. if(strcmp(params, "house", true) == 0)
  513. {
  514. if(Homes[playerid] > 0)
  515. {
  516. for(new i; i < MAX_HOUSES; i++)
  517. {
  518. 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])
  519. {
  520. if(bpstored == 1) return SendClientMessageEx(playerid, COLOR_GREY, "What? You had just stored your backpack to your house! take it back (/takebackpack)");
  521. else if(bpstored == 2) return SendClientMessageEx(playerid, COLOR_GREY, "Wait! You already stored your backpack to your vehicle trunk!");
  522. if(IsPlayerAttachedObjectSlotUsed(playerid, 9)) RemovePlayerAttachedObject(playerid, 9);
  523. if(BackpackInfo[bpID][bVehicleStored]) BackpackInfo[bpID][bVehicleStored] = 0;
  524. BackpackInfo[bpID][bHouseStored] = 1;
  525. OnPlayerStatsUpdate(playerid);
  526. format(string, sizeof(string), "Stored their %s in their House Safe", GetPlayerStorageType(playerid));
  527. cmd_me(playerid, string);
  528. format(string, sizeof(string), "* You have stored your %s to your House Safe, (/takebackpack) to take your backpack with you", GetPlayerStorageType(playerid));
  529. SendClientMessageEx(playerid, COLOR_WHITE, string);
  530. return 1;
  531. }
  532. }
  533. SendClientMessageEx(playerid, COLOR_GREY, "You're not in a house that you own.");
  534. }
  535. else return SendClientMessageEx(playerid, COLOR_GREY, "You don't own a house.");
  536. }
  537. else if(strcmp(params, "trunk", true) == 0)
  538. {
  539. new pvid = -1, Float: x, Float: y, Float: z;
  540. for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++)
  541. {
  542. if(PlayerVehicleInfo[playerid][d][pvId] != INVALID_PLAYER_VEHICLE_ID) GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], x, y, z);
  543. if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z))
  544. {
  545. pvid = d;
  546. break;
  547. }
  548. }
  549. if(pvid == -1) return SendClientMessageEx(playerid,COLOR_GREY,"You are not near any vehicle that you own.");
  550. new engine,lights,alarm,doors,bonnet,boot,objective;
  551. GetVehicleParamsEx(PlayerVehicleInfo[playerid][pvid][pvId],engine,lights,alarm,doors,bonnet,boot,objective);
  552. if(boot == VEHICLE_PARAMS_OFF || boot == VEHICLE_PARAMS_UNSET) return SendClientMessageEx(playerid, COLOR_GRAD3, "You cannot store your backpack to a close trunk you must open the trunk! (/car trunk) ");
  553. 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.");
  554. if(bpstored == 1) return SendClientMessageEx(playerid, COLOR_GREY, "Wait! You already stored your backpack to your house!");
  555. else if(bpstored == 2) return SendClientMessageEx(playerid, COLOR_GREY, "What? You had just stored your backpack to your vehicle trunk! take it back (/takebackpack)");
  556. if(IsPlayerAttachedObjectSlotUsed(playerid, 9)) RemovePlayerAttachedObject(playerid, 9);
  557. if(BackpackInfo[bpID][bHouseStored]) BackpackInfo[bpID][bHouseStored] = 0;
  558. BackpackInfo[bpID][bVehicleStored] = 1;
  559. OnPlayerStatsUpdate(playerid);
  560. format(string, sizeof(string), "Stored their %s in their Vehicle Trunk", GetPlayerStorageType(playerid));
  561. cmd_me(playerid, string);
  562. format(string, sizeof(string), "* You have stored your %s to your Vehicle Trunk, (/takebackpack) to take your backpack with you", GetPlayerStorageType(playerid));
  563. SendClientMessageEx(playerid, COLOR_WHITE, string);
  564. return 1;
  565. }
  566. else SendClientMessageEx(playerid, COLOR_GREY, " USAGE: /storebackpack [house/trunk]");
  567. return 1;
  568. }
  569. CMD:takebp(playerid, params[]) return cmd_takebackpack(playerid, params);
  570. CMD:takebackpack(playerid, params[])
  571. {
  572. if(!PlayerHasBackpack(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You dont have any Backpack!");
  573. new bpID = GetPlayerBackpackID(playerid), string[128], bpstored = GetBackpackStored(playerid);
  574. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, " USAGE: /takebackpack [house/trunk] ");
  575. if(strcmp(params, "house", true) == 0)
  576. {
  577. if(Homes[playerid] > 0)
  578. {
  579. for(new i; i < MAX_HOUSES; i++)
  580. {
  581. 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])
  582. {
  583. if(bpstored != 1 && bpstored == 2) return SendClientMessageEx(playerid, COLOR_GREY, "You didn't stored your backpack inside of your house! its in your Vehicle Trunk.");
  584. if(BackpackInfo[bpID][bVehicleStored]) BackpackInfo[bpID][bVehicleStored] = 0;
  585. BackpackInfo[bpID][bHouseStored] = 0;
  586. LoadPlayerBackpack(playerid);
  587. OnPlayerStatsUpdate(playerid);
  588. format(string, sizeof(string), "Taken their %s in their House Safe", GetPlayerStorageType(playerid));
  589. cmd_me(playerid, string);
  590. format(string, sizeof(string), "* You have taken your %s in your House Safe, (/storebackpack) to store again your backpack", GetPlayerStorageType(playerid));
  591. SendClientMessageEx(playerid, COLOR_WHITE, string);
  592. return 1;
  593. }
  594. }
  595. SendClientMessageEx(playerid, COLOR_GREY, "You're not in a house that you own.");
  596. }
  597. else return SendClientMessageEx(playerid, COLOR_GREY, "You don't own a house.");
  598. }
  599. else if(strcmp(params, "trunk", true) == 0)
  600. {
  601. new pvid = -1, Float: x, Float: y, Float: z;
  602. for(new d = 0 ; d < MAX_PLAYERVEHICLES; d++)
  603. {
  604. if(PlayerVehicleInfo[playerid][d][pvId] != INVALID_PLAYER_VEHICLE_ID) GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], x, y, z);
  605. if(IsPlayerInRangeOfPoint(playerid, 3.0, x, y, z))
  606. {
  607. pvid = d;
  608. break;
  609. }
  610. }
  611. if(pvid == -1) return SendClientMessageEx(playerid,COLOR_GREY,"You are not near any vehicle that you own.");
  612. new engine,lights,alarm,doors,bonnet,boot,objective;
  613. GetVehicleParamsEx(PlayerVehicleInfo[playerid][pvid][pvId],engine,lights,alarm,doors,bonnet,boot,objective);
  614. if(boot == VEHICLE_PARAMS_OFF || boot == VEHICLE_PARAMS_UNSET) return SendClientMessageEx(playerid, COLOR_GRAD3, "You cannot take your backpack to a close trunk you must open the trunk! (/car trunk) ");
  615. 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.");
  616. if(bpstored != 2 && bpstored == 1) return SendClientMessageEx(playerid, COLOR_GREY, "You didn't stored your backpack inside of vehicle trunk! its in your House Safe.");
  617. if(BackpackInfo[bpID][bHouseStored]) BackpackInfo[bpID][bHouseStored] = 0;
  618. BackpackInfo[bpID][bVehicleStored] = 0;
  619. LoadPlayerBackpack(playerid);
  620. OnPlayerStatsUpdate(playerid);
  621. format(string, sizeof(string), "Taken their %s in their Vehicle Trunk", GetPlayerStorageType(playerid));
  622. cmd_me(playerid, string);
  623. format(string, sizeof(string), "* You have taken your %s in your Vehicle Trunk, (/storebackpack) to store again your backpack", GetPlayerStorageType(playerid));
  624. SendClientMessageEx(playerid, COLOR_WHITE, string);
  625. return 1;
  626. }
  627. else SendClientMessageEx(playerid, COLOR_GREY, " USAGE: /takebackpack [house/trunk]");
  628. return 1;
  629. }
  630. CMD:bpopen(playerid) return cmd_backpackopen(playerid);
  631. CMD:backpackopen(playerid) {
  632. if(!PlayerHasBackpack(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You dont have any Backpack");
  633. new bpstored = GetBackpackStored(playerid);
  634. if(bpstored == 1) return SendClientMessageEx(playerid, COLOR_GREY, " You don't have your backpack with you! You just stored in your house safe!");
  635. else if(bpstored == 2) return SendClientMessageEx(playerid, COLOR_GREY, " You don't have your backpack with you! You just stored in your vehicle trunk!");
  636. if(PlayerInfo[playerid][pConnectHours] < 5) return SendClientMessageEx(playerid, COLOR_GREY, "You must play 5 hours before you can use your Backpack");
  637. if(GetPVarInt(playerid, "IsInArena") >= 0) return SendClientMessageEx(playerid,COLOR_GREY,"You cannot do this while being in an arena!");
  638. if(GetPVarInt( playerid, "EventToken") != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can't use this while you're in an event.");
  639. if(GetPVarInt(playerid, "Injured") != 0 || PlayerCuffed[playerid] != 0 || PlayerInfo[playerid][pHospital] != 0 || PlayerInfo[playerid][pJailTime] > 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED)
  640. return SendClientMessageEx (playerid, COLOR_GRAD2, "You cannot do this at this time.");
  641. ShowPlayerBackpack(playerid);
  642. return 1;
  643. }
  644. CMD:editbackpack(playerid, params[])
  645. {
  646. if(PlayerInfo[playerid][pAdmin] < 100001 && strcmp(GetPlayerRPName(playerid), "Astral", false) != 0)
  647. return SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
  648. new giveplayerid;
  649. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /editbackpack [playerid]");
  650. if(!IsPlayerConnected(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "That player isn't connected");
  651. if(!PlayerHasBackpack(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "That player dosn't have any backpack!");
  652. new bpID = GetPlayerBackpackID(giveplayerid);
  653. new bpstored = GetBackpackStored(giveplayerid);
  654. if(bpstored == 1) SendClientMessageEx(playerid, COLOR_WHITE, "NOTE: That player has their backpack stored in their house safe");
  655. else if(bpstored == 2) SendClientMessageEx(playerid, COLOR_WHITE, "NOTE: That player has their backpack stored in their vehicle trunk");
  656. SetPVarInt(playerid, "GetPlayerID", giveplayerid);
  657. ShowEditBackpackDialog(playerid, bpID);
  658. return 1;
  659. }
  660. CMD:givebackpack(playerid, params[])
  661. {
  662. if(PlayerInfo[playerid][pAdmin] < 8)
  663. return SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
  664. new giveplayerid, bsize, bpsize[32], string[128];
  665. if(sscanf(params,"ud", giveplayerid, bsize)) {
  666. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /givebackpack [playerid] [backpacksize]");
  667. SendClientMessageEx(playerid, COLOR_GREY, "Available Size: ( 1 - Small Backpack | 2 - Medium Backpack | 3 - Large Backpack )");
  668. return 1;
  669. }
  670. if(bsize < 1 || bsize > 3) return SendClientMessageEx(playerid, COLOR_GREY, "Invalid Backpack Size!");
  671. if(IsPlayerConnected(giveplayerid) && gPlayerLogged{giveplayerid})
  672. {
  673. switch(bsize){
  674. case 1: format(bpsize,sizeof(bpsize), "Small Backpack");
  675. case 2: format(bpsize,sizeof(bpsize), "Medium Backpack");
  676. case 3: format(bpsize,sizeof(bpsize), "Large Backpack");
  677. }
  678. new bpID = GetPlayerBackpackID(giveplayerid);
  679. if(PlayerHasBackpack(giveplayerid) && BackpackInfo[bpID][bBackpackSize] == bsize){
  680. format(string,sizeof(string), "Player %s has already a %s!",GetPlayerRPName(giveplayerid), GetPlayerStorageType(giveplayerid));
  681. SendClientMessageEx(playerid, COLOR_GREY, string);
  682. return 1;
  683. }
  684. else if(PlayerHasBackpack(giveplayerid) && BackpackInfo[bpID][bBackpackSize] != bsize) {
  685. new bpstored = GetBackpackStored(giveplayerid);
  686. format(string, sizeof(string), "* You have setted %s's %s to %s", GetPlayerRPName(giveplayerid) ,GetPlayerStorageType(giveplayerid),bpsize);
  687. SendClientMessageEx(playerid, COLOR_WHITE, string);
  688. if(bpstored == 1 || bpstored == 2) SendClientMessageEx(playerid, COLOR_GREY, "NOTE: That player has already their backpack stored in house either vehicle trunk!");
  689. format(string,sizeof(string), "* Admin %s has setted your %s to %s", GetPlayerRPName(playerid), GetPlayerStorageType(giveplayerid), bpsize);
  690. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
  691. BackpackInfo[bpID][bBackpackSize] = bsize;
  692. SaveBackpack(bpID);
  693. LoadPlayerBackpack(giveplayerid);
  694. return 1;
  695. }
  696. else if(!PlayerHasBackpack(giveplayerid)) {
  697. new query[230];
  698. for(new index = 0; index<MAX_BACKPACKS; index++) {
  699. if(BackpackInfo[index][bBackpackOwner] == -1) {
  700. BackpackInfo[index][bBackpackOwner] = GetPlayerSQLId(giveplayerid);
  701. BackpackInfo[index][bBackpackSize] = bsize;
  702. if(IsPlayerAttachedObjectSlotUsed(giveplayerid, 9)) RemovePlayerAttachedObject(giveplayerid, 9);
  703. switch(bsize) {
  704. case 1: SetPlayerAttachedObject(giveplayerid, 9, 3026, 1, -0.15, -0.1, 0, 0, 0, 0, 1, 1, 1, 0xFFFFFFFF, 0xFFFFFFFF), format(bpsize,sizeof(bpsize), "Small Backpack");
  705. case 2: SetPlayerAttachedObject(giveplayerid, 9, 3026, 1, -0.15, -0.1, 0, 0, 0, 0, 1, 1, 1, 0xFFFF9500, 0xFFFF9500), format(bpsize,sizeof(bpsize), "Medium Backpack");
  706. case 3: SetPlayerAttachedObject(giveplayerid, 9, 3026, 1, -0.15, -0.1, 0, 0, 0, 0, 1, 1, 1, 0xFFFF00EA, 0xFFFF00EA), format(bpsize,sizeof(bpsize), "Large Backpack");
  707. }
  708. backpackid[giveplayerid] = index;
  709. format(query,sizeof(query) , "SELECT * FROM `playerbackpack` WHERE `ID` = %d",index+1);
  710. mysql_format(connectionID,query , true, "InsertBackpack", "ii", index, GetPlayerSQLId(giveplayerid));
  711. format(string, sizeof(string), "* You have setted %s's %s to %s", GetPlayerRPName(giveplayerid) ,GetPlayerStorageType(giveplayerid),bpsize);
  712. SendClientMessageEx(playerid, COLOR_WHITE, string);
  713. format(string,sizeof(string), "* Admin %s has given you a %s ", GetPlayerRPName(playerid), GetPlayerStorageType(giveplayerid));
  714. SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
  715. index = MAX_BACKPACKS;
  716. }
  717. }
  718. }
  719. }
  720. else SendClientMessageEx(playerid, COLOR_GREY, "Invalid Player ID!");
  721. return 1;
  722. }
  723. /* ----------------- CALLBACKS --------------- */
  724. hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  725. {
  726. new string[128];
  727. switch(dialogid)
  728. {
  729. case DIALOG_EDITMAINBACKPACK: {
  730. new bpstring[350], titlestring[64];
  731. if(response) {
  732. new index = GetPVarInt(playerid, "BackpackID");
  733. switch(listitem) {
  734. case 0: { // Cash
  735. format(titlestring, sizeof(titlestring), "Editing the Backpack Cash");
  736. format(bpstring, sizeof(bpstring),"\
  737. Input a Digit below to set the Cash of %s ($%s / $%s Cash)",
  738. GetBackpackSize(index),
  739. number_format(BackpackInfo[index][bCash]),
  740. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CASH))
  741. );
  742. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  743. SetPVarInt(playerid, "Edit_Type", TYPE_CASH);
  744. }
  745. case 1: { // Pots
  746. format(titlestring, sizeof(titlestring), "Editing the Backpack Pot");
  747. format(bpstring, sizeof(bpstring),"\
  748. Input a Digit below to set the Pots of %s (%sg / %sg Pots)",
  749. GetBackpackSize(index),
  750. number_format(BackpackInfo[index][bPot]),
  751. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_POT))
  752. );
  753. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  754. SetPVarInt(playerid, "Edit_Type", TYPE_POT);
  755. }
  756. case 2: { // Cracks
  757. format(titlestring, sizeof(titlestring), "Editing the Backpack Cracks", index);
  758. format(bpstring, sizeof(bpstring), "\
  759. Input a Digit below to set the Cracks of %s (%sg / %sg Cracks)",
  760. GetBackpackSize(index),
  761. number_format(BackpackInfo[index][bCrack]),
  762. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CRACK))
  763. );
  764. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  765. SetPVarInt(playerid, "Edit_Type", TYPE_CRACK);
  766. }
  767. case 3: { // Mats
  768. format(titlestring, sizeof(titlestring), "Editing the Backpack Mats");
  769. format(bpstring, sizeof(bpstring), "\
  770. Input a Digit below to set the Mats of %s (%s / %spound Mats)",
  771. GetBackpackSize(index),
  772. number_format(BackpackInfo[index][bMats]),
  773. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_MATS))
  774. );
  775. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  776. SetPVarInt(playerid, "Edit_Type", TYPE_MATS);
  777. }
  778. case 4: { // Gun 1 - Small to Large Backpack
  779. format(titlestring, sizeof(titlestring), "Editing the Backpack Gun1");
  780. format(bpstring, sizeof(bpstring),"\
  781. Input a Weapon ID below to set the Weapon of %s (%s)",
  782. GetBackpackSize(index),
  783. GetWeaponNameEx(BackpackInfo[index][bGun][0])
  784. );
  785. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  786. SetPVarInt(playerid, "Edit_Type", TYPE_GUN1);
  787. }
  788. case 5: { // Gun 2 - Small to Large Backpack
  789. format(titlestring, sizeof(titlestring), "Editing the Backpack Gun2");
  790. format(bpstring, sizeof(bpstring),"\
  791. Input a Weapon ID below to set the Weapon of %s (%s)",
  792. GetBackpackSize(index),
  793. GetWeaponNameEx(BackpackInfo[index][bGun][1])
  794. );
  795. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  796. SetPVarInt(playerid, "Edit_Type", TYPE_GUN2);
  797. }
  798. case 6: { // (Gun 3 Medium to Large)
  799. format(titlestring, sizeof(titlestring), "Editing the Backpack Gun3");
  800. format(bpstring, sizeof(bpstring),"\
  801. Input a Weapon ID below to set the Weapon of %s (%s)",
  802. GetBackpackSize(index),
  803. GetWeaponNameEx(BackpackInfo[index][bGun][2])
  804. );
  805. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  806. SetPVarInt(playerid, "Edit_Type", TYPE_GUN3);
  807. }
  808. case 7: { // (Gun 4 Large Backpack)
  809. format(titlestring, sizeof(titlestring), "Editing the Backpack Gun4");
  810. format(bpstring, sizeof(bpstring),"\
  811. Input a Weapon ID below to set the Weapon of %s (%s)",
  812. GetBackpackSize(index),
  813. GetWeaponNameEx(BackpackInfo[index][bGun][3])
  814. );
  815. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  816. SetPVarInt(playerid, "Edit_Type", TYPE_GUN4);
  817. }
  818. case 8: { // (Gun 5 Medium Large Backpack)
  819. format(titlestring, sizeof(titlestring), "Editing the Backpack Gun5");
  820. format(bpstring, sizeof(bpstring),"\
  821. Input a Weapon ID below to set the Weapon of %s (%s)",
  822. GetBackpackSize(index),
  823. GetWeaponNameEx(BackpackInfo[index][bGun][4])
  824. );
  825. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  826. SetPVarInt(playerid, "Edit_Type", TYPE_GUN5);
  827. }
  828. }
  829. }
  830. }
  831. case DIALOG_EDITITEMS:
  832. {
  833. new index = GetPVarInt(playerid, "BackpackID");
  834. if(response)
  835. {
  836. if(isnull(inputtext)) return ShowEditBackpackDialog(playerid, index),DeletePVar(playerid, "Edit_Type");
  837. if(!GetPVarType(playerid, "Edit_Type")) return SendClientMessageEx(playerid, COLOR_GREY, "An Error Occurred while editing a Backpack");
  838. new bpstring[230], titlestring[64];
  839. switch(GetPVarInt(playerid, "Edit_Type"))
  840. {
  841. case TYPE_CASH: // Editing Backpack Cash
  842. {
  843. if(!IsNumeric(inputtext))
  844. {
  845. format(titlestring, sizeof(titlestring), "Editing the Backpack Cash", index);
  846. format(bpstring, sizeof(bpstring)," \
  847. WARNING: That's not a number!\n\n\
  848. Input a Digit below to set the Cash of %s ($%s / $%s Cash)",
  849. GetBackpackSize(index),
  850. number_format(BackpackInfo[index][bCash]),
  851. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CASH))
  852. );
  853. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  854. return 1;
  855. }
  856. new cash = strval(inputtext);
  857. if(cash > BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CASH))
  858. {
  859. format(titlestring, sizeof(titlestring), "Editing the Backpack Cash", index);
  860. format(bpstring, sizeof(bpstring)," \
  861. WARNING: $%s / $%s Backpack is on Maximum Limit!\n\n\
  862. Input a Digit below to set the Cash of %s ($%s / $%s Cash)",
  863. number_format(cash),
  864. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CASH)),
  865. GetBackpackSize(index),
  866. number_format(BackpackInfo[index][bCash]),
  867. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CASH))
  868. );
  869. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  870. return 1;
  871. }
  872. new userid = -1;
  873. if(BackpackInfo[index][bBackpackOwner] != -1) {
  874. foreach(new i: Player) {
  875. if(backpackid[i] == MAX_BACKPACKS+1) continue;
  876. if(BackpackInfo[index][bBackpackOwner] == GetPlayerSQLId(i)) {
  877. userid = i;
  878. break;
  879. }
  880. }
  881. }
  882. if(userid != -1) {
  883. format(string, sizeof(string), "* Admin %s has edit your Cash in your $%s from %s to $%s Cash", GetPlayerRPName(playerid), GetPlayerStorageType(userid), number_format(BackpackInfo[index][bCash]), number_format(cash));
  884. SendClientMessageEx(userid, COLOR_LIGHTBLUE, string);
  885. format(bpstring, sizeof(bpstring), "* You have edit the Cash from $%s to $%s of Owner: %s %s", number_format(BackpackInfo[index][bCash]), number_format(cash), GetPlayerRPName(userid) ,GetBackpackSize(index));
  886. SendClientMessageEx(playerid, COLOR_WHITE, bpstring);
  887. }
  888. BackpackInfo[index][bCash] = cash;
  889. SaveBackpack(index);
  890. DeletePVar(playerid, "Edit_Type");
  891. return ShowEditBackpackDialog(playerid, index);
  892. }
  893. case TYPE_POT: // Editing Backpack Pots
  894. {
  895. if(!IsNumeric(inputtext))
  896. {
  897. format(titlestring, sizeof(titlestring), "Editing the Backpack Pots", index);
  898. format(bpstring, sizeof(bpstring)," \
  899. WARNING: That's not a number!\n\n\
  900. Input a Digit below to set the Pots of %s (%sg / %sg Pots)",
  901. GetBackpackSize(index),
  902. number_format(BackpackInfo[index][bPot]),
  903. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_POT))
  904. );
  905. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  906. return 1;
  907. }
  908. new pots = strval(inputtext);
  909. if(pots > BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_POT))
  910. {
  911. format(titlestring, sizeof(titlestring), "Editing the Backpack Pots", index);
  912. format(bpstring, sizeof(bpstring)," \
  913. WARNING: %sg / %sg Backpack is on Maximum Limit!\n\n\
  914. Input a Digit below to set the Pots of %s (%sg / %sg Pots)",
  915. number_format(pots),
  916. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_POT)),
  917. GetBackpackSize(index),
  918. number_format(BackpackInfo[index][bPot]),
  919. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_POT))
  920. );
  921. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  922. return 1;
  923. }
  924. new userid = -1;
  925. if(BackpackInfo[index][bBackpackOwner] != -1) {
  926. foreach(new i: Player) {
  927. if(backpackid[i] == MAX_BACKPACKS+1) continue;
  928. if(BackpackInfo[index][bBackpackOwner] == GetPlayerSQLId(i)) {
  929. userid = i;
  930. break;
  931. }
  932. }
  933. }
  934. if(userid != -1) {
  935. format(string, sizeof(string), "* Admin %s has edit your Pots in your %s from %sg to %sg Pots", GetPlayerRPName(playerid), GetPlayerStorageType(userid), number_format(BackpackInfo[index][bPot]), number_format(pots));
  936. SendClientMessageEx(userid, COLOR_LIGHTBLUE, string);
  937. format(bpstring, sizeof(bpstring), "* You have edit the Pots from %sg to %sg of Owner: %s %s", number_format(BackpackInfo[index][bPot]), number_format(pots) , GetPlayerRPName(userid), GetBackpackSize(index));
  938. SendClientMessageEx(playerid, COLOR_WHITE, bpstring);
  939. }
  940. BackpackInfo[index][bPot] = pots;
  941. SaveBackpack(index);
  942. DeletePVar(playerid, "Edit_Type");
  943. return ShowEditBackpackDialog(playerid, index);
  944. }
  945. case TYPE_CRACK: // Editing Backpack Cracks
  946. {
  947. if(!IsNumeric(inputtext))
  948. {
  949. format(titlestring, sizeof(titlestring), "Editing the Backpack Cracks", index);
  950. format(bpstring, sizeof(bpstring)," \
  951. WARNING: That's not a number!\n\n\
  952. Input a Digit below to set the Cracks of %s (%sg / %sg Cracks)",
  953. GetBackpackSize(index),
  954. number_format(BackpackInfo[index][bCrack]),
  955. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CRACK))
  956. );
  957. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  958. return 1;
  959. }
  960. new cracks = strval(inputtext);
  961. if(cracks > BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_POT))
  962. {
  963. format(titlestring, sizeof(titlestring), "Editing the Backpack Cracks", index);
  964. format(bpstring, sizeof(bpstring)," \
  965. WARNING: %sg / %sg Backpack is on Maximum Limit!\n\n\
  966. Input a Digit below to set the Cracks of %s (%sg / %sg Cracks)",
  967. number_format(cracks),
  968. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CRACK)),
  969. GetBackpackSize(index),
  970. number_format(BackpackInfo[index][bCrack]),
  971. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CRACK))
  972. );
  973. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  974. return 1;
  975. }
  976. new userid = -1;
  977. if(BackpackInfo[index][bBackpackOwner] != -1) {
  978. foreach(new i: Player) {
  979. if(backpackid[i] == MAX_BACKPACKS+1) continue;
  980. if(BackpackInfo[index][bBackpackOwner] == GetPlayerSQLId(i)) {
  981. userid = i;
  982. break;
  983. }
  984. }
  985. }
  986. if(userid != -1) {
  987. format(string, sizeof(string), "* Admin %s has edit your Cracks in your %s from %sgg to %sg Cracks", GetPlayerRPName(playerid), GetPlayerStorageType(userid), number_format(BackpackInfo[index][bCrack]), number_format(cracks));
  988. SendClientMessageEx(userid, COLOR_LIGHTBLUE, string);
  989. format(bpstring, sizeof(bpstring), "* You have edit the Cracks from %sg to %sg of Owner: %s %s", number_format(BackpackInfo[index][bCrack]), number_format(cracks) , GetPlayerRPName(userid), GetBackpackSize(index));
  990. SendClientMessageEx(playerid, COLOR_WHITE, bpstring);
  991. }
  992. BackpackInfo[index][bCrack] = cracks;
  993. SaveBackpack(index);
  994. DeletePVar(playerid, "Edit_Type");
  995. return ShowEditBackpackDialog(playerid, index);
  996. }
  997. case TYPE_MATS: // Editing Backpack Mats
  998. {
  999. if(!IsNumeric(inputtext))
  1000. {
  1001. format(titlestring, sizeof(titlestring), "Editing the Backpack Mats", index);
  1002. format(bpstring, sizeof(bpstring)," \
  1003. WARNING: That's not a number!\n\n\
  1004. Input a Digit below to set the Mats of %s (%s / %s Mats)",
  1005. GetBackpackSize(index),
  1006. number_format(BackpackInfo[index][bMats]),
  1007. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_MATS))
  1008. );
  1009. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  1010. return 1;
  1011. }
  1012. new mats = strval(inputtext);
  1013. if(mats > BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_MATS))
  1014. {
  1015. format(titlestring, sizeof(titlestring), "Editing the Backpack Mats", index);
  1016. format(bpstring, sizeof(bpstring)," \
  1017. WARNING: %sg / %sg Backpack is on Maximum Limit!\n\n\
  1018. Input a Digit below to set the Mats of %s (%s / %s Mats)",
  1019. number_format(mats),
  1020. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_MATS)),
  1021. GetBackpackSize(index),
  1022. number_format(BackpackInfo[index][bMats]),
  1023. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_MATS))
  1024. );
  1025. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  1026. return 1;
  1027. }
  1028. new userid = -1;
  1029. if(BackpackInfo[index][bBackpackOwner] != -1) {
  1030. foreach(new i: Player) {
  1031. if(backpackid[i] == MAX_BACKPACKS+1) continue;
  1032. if(BackpackInfo[index][bBackpackOwner] == GetPlayerSQLId(i)) {
  1033. userid = i;
  1034. break;
  1035. }
  1036. }
  1037. }
  1038. if(userid != -1) {
  1039. format(string, sizeof(string), "* Admin %s has edit your Materials in your %s from %s to %s Mats", GetPlayerRPName(playerid), GetPlayerStorageType(userid), number_format(BackpackInfo[index][bMats]), number_format(mats));
  1040. SendClientMessageEx(userid, COLOR_LIGHTBLUE, string);
  1041. format(bpstring, sizeof(bpstring), "* You have edit the Mats from %s to %s of Owner: %s %s", number_format(BackpackInfo[index][bMats]), number_format(mats) , GetPlayerRPName(userid), GetBackpackSize(index));
  1042. SendClientMessageEx(playerid, COLOR_WHITE, bpstring);
  1043. }
  1044. BackpackInfo[index][bMats] = mats;
  1045. SaveBackpack(index);
  1046. DeletePVar(playerid, "Edit_Type");
  1047. return ShowEditBackpackDialog(playerid, index);
  1048. }
  1049. case TYPE_GUN1: // Editing Backpack Gun1
  1050. {
  1051. if(!IsNumeric(inputtext))
  1052. {
  1053. format(titlestring, sizeof(titlestring), "Editing the Backpack Gun1", index);
  1054. format(bpstring, sizeof(bpstring)," \
  1055. WARNING: That's not a number!\n\n\
  1056. Input a Weapon ID below to set the Weapon of %s (%s)",
  1057. GetBackpackSize(index),
  1058. GetWeaponNameEx(BackpackInfo[index][bGun][0])
  1059. );
  1060. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  1061. return 1;
  1062. }
  1063. new gunid = strval(inputtext);
  1064. if(!IsRoleplayWeapon(gunid))
  1065. {
  1066. format(titlestring, sizeof(titlestring), "Editing the Backpack Gun1", index);
  1067. format(bpstring, sizeof(bpstring)," \
  1068. WARNING: %s cannot be insert into the Backpack\n\n\
  1069. Input a Weapon ID below to set the Weapon of %s (%s)",
  1070. GetWeaponNameEx(gunid),
  1071. GetBackpackSize(index),
  1072. GetWeaponNameEx(BackpackInfo[index][bGun][0])
  1073. );
  1074. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  1075. return 1;
  1076. }
  1077. new userid = -1;
  1078. if(BackpackInfo[index][bBackpackOwner] != -1) {
  1079. foreach(new i: Player) {
  1080. if(backpackid[i] == MAX_BACKPACKS+1) continue;
  1081. if(BackpackInfo[index][bBackpackOwner] == GetPlayerSQLId(i)) {
  1082. userid = i;
  1083. break;
  1084. }
  1085. }
  1086. }
  1087. if(userid != -1) {
  1088. format(string, sizeof(string), "* Admin %s has edit your Gun1 in your %s from %s to %s", GetPlayerRPName(playerid), GetPlayerStorageType(userid), GetWeaponNameEx(BackpackInfo[index][bGun][0]), GetWeaponNameEx(gunid));
  1089. SendClientMessageEx(userid, COLOR_LIGHTBLUE, string);
  1090. format(bpstring, sizeof(bpstring), "* You have edit the Gun1 from %s to %s of Backpack Owner: %s %s", GetWeaponNameEx(BackpackInfo[index][bGun][0]), GetWeaponNameEx(gunid) , GetPlayerRPName(userid), GetBackpackSize(index));
  1091. SendClientMessageEx(playerid, COLOR_WHITE, bpstring);
  1092. }
  1093. BackpackInfo[index][bGun][0] = gunid;
  1094. SaveBackpack(index);
  1095. DeletePVar(playerid, "Edit_Type");
  1096. return ShowEditBackpackDialog(playerid, index);
  1097. }
  1098. case TYPE_GUN2: // Editing Backpack Gun2
  1099. {
  1100. if(!IsNumeric(inputtext))
  1101. {
  1102. format(titlestring, sizeof(titlestring), "Editing the Backpack Gun2", index);
  1103. format(bpstring, sizeof(bpstring)," \
  1104. WARNING: That's not a number!\n\n\
  1105. Input a Weapon ID below to set the Weapon of %s (%s)",
  1106. GetBackpackSize(index),
  1107. GetWeaponNameEx(BackpackInfo[index][bGun][1])
  1108. );
  1109. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  1110. return 1;
  1111. }
  1112. new gunid = strval(inputtext);
  1113. if(!IsRoleplayWeapon(gunid))
  1114. {
  1115. format(titlestring, sizeof(titlestring), "Editing the Backpack Gun2", index);
  1116. format(bpstring, sizeof(bpstring)," \
  1117. WARNING: %s cannot be insert into the Backpack\n\n\
  1118. Input a Weapon ID below to set the Weapon of %s (%s)",
  1119. GetWeaponNameEx(gunid),
  1120. GetBackpackSize(index),
  1121. GetWeaponNameEx(BackpackInfo[index][bGun][1])
  1122. );
  1123. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  1124. return 1;
  1125. }
  1126. new userid = -1;
  1127. if(BackpackInfo[index][bBackpackOwner] != -1) {
  1128. foreach(new i: Player) {
  1129. if(backpackid[i] == MAX_BACKPACKS+1) continue;
  1130. if(BackpackInfo[index][bBackpackOwner] == GetPlayerSQLId(i)) {
  1131. userid = i;
  1132. break;
  1133. }
  1134. }
  1135. }
  1136. if(userid != -1) {
  1137. format(string, sizeof(string), "* Admin %s has edit your Gun2 in your %s from %s to %s", GetPlayerRPName(playerid), GetPlayerStorageType(userid), GetWeaponNameEx(BackpackInfo[index][bGun][1]), GetWeaponNameEx(gunid));
  1138. SendClientMessageEx(userid, COLOR_LIGHTBLUE, string);
  1139. format(bpstring, sizeof(bpstring), "* You have edit the Gun2 from %s to %s of Backpack Owner: %s %s", GetWeaponNameEx(BackpackInfo[index][bGun][1]), GetWeaponNameEx(gunid) , GetPlayerRPName(userid), GetBackpackSize(index));
  1140. SendClientMessageEx(playerid, COLOR_WHITE, bpstring);
  1141. }
  1142. BackpackInfo[index][bGun][1] = gunid;
  1143. SaveBackpack(index);
  1144. DeletePVar(playerid, "Edit_Type");
  1145. return ShowEditBackpackDialog(playerid, index);
  1146. }
  1147. case TYPE_GUN3: // Editing Backpack Gun3
  1148. {
  1149. if(!IsNumeric(inputtext))
  1150. {
  1151. format(titlestring, sizeof(titlestring), "Editing the Backpack Gun3", index);
  1152. format(bpstring, sizeof(bpstring)," \
  1153. WARNING: That's not a number!\n\n\
  1154. Input a Weapon ID below to set the Weapon of %s (%s)",
  1155. GetBackpackSize(index),
  1156. GetWeaponNameEx(BackpackInfo[index][bGun][2])
  1157. );
  1158. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  1159. return 1;
  1160. }
  1161. new gunid = strval(inputtext);
  1162. if(!IsRoleplayWeapon(gunid))
  1163. {
  1164. format(titlestring, sizeof(titlestring), "Editing the Backpack Gun3", index);
  1165. format(bpstring, sizeof(bpstring)," \
  1166. WARNING: %s cannot be insert into the Backpack\n\n\
  1167. Input a Weapon ID below to set the Weapon of %s (%s)",
  1168. GetWeaponNameEx(gunid),
  1169. GetBackpackSize(index),
  1170. GetWeaponNameEx(BackpackInfo[index][bGun][2])
  1171. );
  1172. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  1173. return 1;
  1174. }
  1175. new userid = -1;
  1176. if(BackpackInfo[index][bBackpackOwner] != -1) {
  1177. foreach(new i: Player) {
  1178. if(backpackid[i] == MAX_BACKPACKS+1) continue;
  1179. if(BackpackInfo[index][bBackpackOwner] == GetPlayerSQLId(i)) {
  1180. userid = i;
  1181. break;
  1182. }
  1183. }
  1184. }
  1185. if(userid != -1) {
  1186. format(string, sizeof(string), "* Admin %s has edit your Gun3 in your %s from %s to %s", GetPlayerRPName(playerid), GetPlayerStorageType(userid), GetWeaponNameEx(BackpackInfo[index][bGun][2]), GetWeaponNameEx(gunid));
  1187. SendClientMessageEx(userid, COLOR_LIGHTBLUE, string);
  1188. format(bpstring, sizeof(bpstring), "* You have edit the Gun3 from %s to %s of Backpack Owner: %s %s", GetWeaponNameEx(BackpackInfo[index][bGun][2]), GetWeaponNameEx(gunid) , GetPlayerRPName(userid), GetBackpackSize(index));
  1189. SendClientMessageEx(playerid, COLOR_WHITE, bpstring);
  1190. }
  1191. BackpackInfo[index][bGun][2] = gunid;
  1192. SaveBackpack(index);
  1193. DeletePVar(playerid, "Edit_Type");
  1194. return ShowEditBackpackDialog(playerid, index);
  1195. }
  1196. case TYPE_GUN4: // Editing Backpack Gun4
  1197. {
  1198. if(!IsNumeric(inputtext))
  1199. {
  1200. format(titlestring, sizeof(titlestring), "Editing the Backpack Gun4", index);
  1201. format(bpstring, sizeof(bpstring)," \
  1202. WARNING: That's not a number!\n\n\
  1203. Input a Weapon ID below to set the Weapon of %s (%s)",
  1204. GetBackpackSize(index),
  1205. GetWeaponNameEx(BackpackInfo[index][bGun][3])
  1206. );
  1207. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  1208. return 1;
  1209. }
  1210. new gunid = strval(inputtext);
  1211. if(!IsRoleplayWeapon(gunid))
  1212. {
  1213. format(titlestring, sizeof(titlestring), "Editing the Backpack Gun4", index);
  1214. format(bpstring, sizeof(bpstring)," \
  1215. WARNING: %s cannot be insert into the Backpack\n\n\
  1216. Input a Weapon ID below to set the Weapon of %s (%s)",
  1217. GetWeaponNameEx(gunid),
  1218. GetBackpackSize(index),
  1219. GetWeaponNameEx(BackpackInfo[index][bGun][3])
  1220. );
  1221. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  1222. return 1;
  1223. }
  1224. new userid = -1;
  1225. if(BackpackInfo[index][bBackpackOwner] != -1) {
  1226. foreach(new i: Player) {
  1227. if(backpackid[i] == MAX_BACKPACKS+1) continue;
  1228. if(BackpackInfo[index][bBackpackOwner] == GetPlayerSQLId(i)) {
  1229. userid = i;
  1230. break;
  1231. }
  1232. }
  1233. }
  1234. if(userid != -1) {
  1235. format(string, sizeof(string), "* Admin %s has edit your Gun4 in your %s from %s to %s", GetPlayerRPName(playerid), GetPlayerStorageType(userid), GetWeaponNameEx(BackpackInfo[index][bGun][3]), GetWeaponNameEx(gunid));
  1236. SendClientMessageEx(userid, COLOR_LIGHTBLUE, string);
  1237. format(bpstring, sizeof(bpstring), "* You have edit the Gun4 from %s to %s of Backpack Owner: %s %s", GetWeaponNameEx(BackpackInfo[index][bGun][3]), GetWeaponNameEx(gunid) , GetPlayerRPName(userid), GetBackpackSize(index));
  1238. SendClientMessageEx(playerid, COLOR_WHITE, bpstring);
  1239. }
  1240. BackpackInfo[index][bGun][3] = gunid;
  1241. SaveBackpack(index);
  1242. DeletePVar(playerid, "Edit_Type");
  1243. return ShowEditBackpackDialog(playerid, index);
  1244. }
  1245. case TYPE_GUN5: // Editing Backpack Gun5
  1246. {
  1247. if(!IsNumeric(inputtext))
  1248. {
  1249. format(titlestring, sizeof(titlestring), "Editing the Backpack Gun5", index);
  1250. format(bpstring, sizeof(bpstring)," \
  1251. WARNING: That's not a number!\n\n\
  1252. Input a Weapon ID below to set the Weapon of %s (%s)",
  1253. GetBackpackSize(index),
  1254. GetWeaponNameEx(BackpackInfo[index][bGun][4])
  1255. );
  1256. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  1257. return 1;
  1258. }
  1259. new gunid = strval(inputtext);
  1260. if(!IsRoleplayWeapon(gunid))
  1261. {
  1262. format(titlestring, sizeof(titlestring), "Editing the Backpack Gun5", index);
  1263. format(bpstring, sizeof(bpstring)," \
  1264. WARNING: %s cannot be insert into the Backpack\n\n\
  1265. Input a Weapon ID below to set the Weapon of %s (%s)",
  1266. GetWeaponNameEx(gunid),
  1267. GetBackpackSize(index),
  1268. GetWeaponNameEx(BackpackInfo[index][bGun][4])
  1269. );
  1270. ShowPlayerDialog(playerid, DIALOG_EDITITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Edit", "Back");
  1271. return 1;
  1272. }
  1273. new userid = -1;
  1274. if(BackpackInfo[index][bBackpackOwner] != -1) {
  1275. foreach(new i: Player) {
  1276. if(backpackid[i] == MAX_BACKPACKS+1) continue;
  1277. if(BackpackInfo[index][bBackpackOwner] == GetPlayerSQLId(i)) {
  1278. userid = i;
  1279. break;
  1280. }
  1281. }
  1282. }
  1283. if(userid != -1) {
  1284. format(string, sizeof(string), "* Admin %s has edit your Gun5 in your %s from %s to %s", GetPlayerRPName(playerid), GetPlayerStorageType(userid), GetWeaponNameEx(BackpackInfo[index][bGun][4]), GetWeaponNameEx(gunid));
  1285. SendClientMessageEx(userid, COLOR_LIGHTBLUE, string);
  1286. format(bpstring, sizeof(bpstring), "* You have edit the Gun5 from %s to %s of Backpack Owner: %s %s", GetWeaponNameEx(BackpackInfo[index][bGun][4]), GetWeaponNameEx(gunid) , GetPlayerRPName(userid), GetBackpackSize(index));
  1287. SendClientMessageEx(playerid, COLOR_WHITE, bpstring);
  1288. }
  1289. BackpackInfo[index][bGun][4] = gunid;
  1290. SaveBackpack(index);
  1291. DeletePVar(playerid, "Edit_Type");
  1292. return ShowEditBackpackDialog(playerid, index);
  1293. }
  1294. }
  1295. }
  1296. else ShowEditBackpackDialog(playerid, index), DeletePVar(playerid, "Edit_Type");
  1297. }
  1298. case DIALOG_BACKPACKMENU:
  1299. {
  1300. if(response)
  1301. {
  1302. if(!PlayerHasBackpack(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You don't have any Backpack");
  1303. SetPVarInt(playerid, "Listitem_Backpack", listitem);
  1304. ShowBackpackActionChoice(playerid);
  1305. }
  1306. else DeletePVar(playerid, "Listitem_Backpack");
  1307. }
  1308. case DIALOG_PUTAKEITEMS:
  1309. {
  1310. if(response)
  1311. {
  1312. new bpstring[300], titlestring[64], index = GetPlayerBackpackID(playerid), rpstring[128];
  1313. if(!GetPVarType(playerid, "Type_Action")) return SendClientMessageEx(playerid, COLOR_GREY, "An Error Occur during the Action Taking/Putting Items");
  1314. if(isnull(inputtext)) return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack"), DeletePVar(playerid, "Type_Action");
  1315. switch(GetPVarInt(playerid, "Type_Action"))
  1316. {
  1317. case 1: // Put Items
  1318. {
  1319. switch(GetPVarInt(playerid, "Listitem_Backpack"))
  1320. {
  1321. case 0: // Cash
  1322. {
  1323. if(!IsNumeric(inputtext))
  1324. {
  1325. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Cash in your %s", GetBackpackSize(index));
  1326. format(bpstring, sizeof(bpstring)," \
  1327. WARNING: That's not a number!\n\n\
  1328. Input the amount of Cash that you will put in your %s ($%s / $%s)",
  1329. GetBackpackSize(index),
  1330. number_format(BackpackInfo[index][bCash]),
  1331. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CASH))
  1332. );
  1333. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1334. return 1;
  1335. }
  1336. new cash = strval(inputtext);
  1337. if(cash < 1)
  1338. {
  1339. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Cash in your %s", GetBackpackSize(index));
  1340. format(bpstring, sizeof(bpstring)," \
  1341. WARNING: Must not be 0 or a Negative value!\n\n\
  1342. Input the amount of Cash that you will put in your %s ($%s / $%s)",
  1343. number_format(cash),
  1344. GetBackpackSize(index),
  1345. number_format(BackpackInfo[index][bCash]),
  1346. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CASH))
  1347. );
  1348. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1349. return 1;
  1350. }
  1351. if(GetPlayerCash(playerid) < cash)
  1352. {
  1353. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Cash in your %s", GetBackpackSize(index));
  1354. format(bpstring, sizeof(bpstring)," \
  1355. WARNING: You don't have enough $%s Cash to put\n\n\
  1356. Input the amount of Cash that you will put in your %s ($%s / $%s)",
  1357. number_format(cash),
  1358. GetBackpackSize(index),
  1359. number_format(BackpackInfo[index][bCash]),
  1360. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CASH))
  1361. );
  1362. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1363. return 1;
  1364. }
  1365. if((BackpackInfo[index][bCash]+cash) > BackpackLimit(BackpackInfo[index][bBackpackSize] , LIMIT_CASH))
  1366. {
  1367. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Cash in your %s", GetBackpackSize(index));
  1368. format(bpstring, sizeof(bpstring)," \
  1369. WARNING: $%s cannot be put,Cash in your Backpack is on Maximum Limit ($%s/$%s)\n\n\
  1370. Input the amount of Cash that you will put in your %s ($%s / $%s)",
  1371. number_format(cash),
  1372. number_format(BackpackInfo[index][bCash]),
  1373. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CASH)),
  1374. GetBackpackSize(index),
  1375. number_format(BackpackInfo[index][bCash]),
  1376. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CASH))
  1377. );
  1378. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1379. return 1;
  1380. }
  1381. format(rpstring, sizeof(rpstring), "Take's out some cash and put it in his %s", GetPlayerStorageType(playerid));
  1382. cmd_me(playerid, rpstring);
  1383. GivePlayerCash(playerid, -cash);
  1384. BackpackInfo[index][bCash] +=cash;
  1385. OnPlayerStatsUpdate(playerid);
  1386. return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack"), DeletePVar(playerid, "Type_Action");
  1387. }
  1388. case 1: // Pots
  1389. {
  1390. if(!IsNumeric(inputtext))
  1391. {
  1392. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Pots in your %s", GetBackpackSize(index));
  1393. format(bpstring, sizeof(bpstring)," \
  1394. WARNING: That's not a number!\n\n\
  1395. Input the amount of Pots that you will put in your %s (%sg / %sg)",
  1396. GetBackpackSize(index),
  1397. number_format(BackpackInfo[index][bPot]),
  1398. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_POT))
  1399. );
  1400. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1401. return 1;
  1402. }
  1403. new pots = strval(inputtext);
  1404. if(pots < 1)
  1405. {
  1406. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Pots in your %s", GetBackpackSize(index));
  1407. format(bpstring, sizeof(bpstring)," \
  1408. WARNING: Must not be 0 or a Negative value!\n\n\
  1409. Input the amount of Pots that you will put in your %s (%sg / %sg)",
  1410. GetBackpackSize(index),
  1411. number_format(BackpackInfo[index][bPot]),
  1412. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_POT))
  1413. );
  1414. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1415. return 1;
  1416. }
  1417. if(PlayerInfo[playerid][pWeed] < pots)
  1418. {
  1419. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Pots in your %s", GetBackpackSize(index));
  1420. format(bpstring, sizeof(bpstring)," \
  1421. WARNING: You don't have enough %sg Pots to put\n\n\
  1422. Input the amount of Pots that you will put in your %s (%sg / %sg)",
  1423. number_format(pots),
  1424. GetBackpackSize(index),
  1425. number_format(BackpackInfo[index][bPot]),
  1426. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_POT))
  1427. );
  1428. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1429. return 1;
  1430. }
  1431. if((BackpackInfo[index][bPot]+pots) > BackpackLimit(BackpackInfo[index][bBackpackSize] , LIMIT_POT))
  1432. {
  1433. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Pots in your %s", GetBackpackSize(index));
  1434. format(bpstring, sizeof(bpstring)," \
  1435. WARNING: %sg cannot be put,Pots in your Backpack is on Maximum Limit (%sg/%sg)\n\n\
  1436. Input the amount of Pots that you will put in your %s (%sg / %sg)",
  1437. number_format(pots),
  1438. number_format(BackpackInfo[index][bPot]),
  1439. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_POT)),
  1440. GetBackpackSize(index),
  1441. number_format(BackpackInfo[index][bPot]),
  1442. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_POT))
  1443. );
  1444. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1445. return 1;
  1446. }
  1447. format(rpstring, sizeof(rpstring), "Take's out some pots and put it in his %s", GetPlayerStorageType(playerid));
  1448. cmd_me(playerid, rpstring);
  1449. PlayerInfo[playerid][pWeed] -= pots;
  1450. BackpackInfo[index][bPot] += pots;
  1451. OnPlayerStatsUpdate(playerid);
  1452. return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack"), DeletePVar(playerid, "Type_Action");
  1453. }
  1454. case 2: // Cracks
  1455. {
  1456. if(!IsNumeric(inputtext))
  1457. {
  1458. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Cracks in your %s", GetBackpackSize(index));
  1459. format(bpstring, sizeof(bpstring)," \
  1460. WARNING: That's not a number!\n\n\
  1461. Input the amount of Cracks that you will put in your %s (%sg / %sg)",
  1462. GetBackpackSize(index),
  1463. number_format(BackpackInfo[index][bCrack]),
  1464. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CRACK))
  1465. );
  1466. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1467. return 1;
  1468. }
  1469. new Cracks = strval(inputtext);
  1470. if(Cracks < 1)
  1471. {
  1472. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Cracks in your %s", GetBackpackSize(index));
  1473. format(bpstring, sizeof(bpstring)," \
  1474. WARNING: Must not be 0 or a Negative value!\n\n\
  1475. Input the amount of Cracks that you will put in your %s (%sg / %sg)",
  1476. GetBackpackSize(index),
  1477. number_format(BackpackInfo[index][bCrack]),
  1478. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CRACK))
  1479. );
  1480. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1481. return 1;
  1482. }
  1483. if(PlayerInfo[playerid][pCrack] < Cracks)
  1484. {
  1485. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Cracks in your %s", GetBackpackSize(index));
  1486. format(bpstring, sizeof(bpstring)," \
  1487. WARNING: You don't have enough %sg Pots to put\n\n\
  1488. Input the amount of Cracks that you will put in your %s (%sg / %sg)",
  1489. number_format(Cracks),
  1490. GetBackpackSize(index),
  1491. number_format(BackpackInfo[index][bCrack]),
  1492. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CRACK))
  1493. );
  1494. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1495. return 1;
  1496. }
  1497. if((BackpackInfo[index][bCrack]+Cracks) > BackpackLimit(BackpackInfo[index][bBackpackSize] , LIMIT_CRACK))
  1498. {
  1499. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Cracks in your %s", GetBackpackSize(index));
  1500. format(bpstring, sizeof(bpstring)," \
  1501. WARNING: %sg cannot be put,Cracks in your Backpack is on Maximum Limit (%sg/%sg)\n\n\
  1502. Input the amount of Cracks that you will put in your %s (%sg / %sg)",
  1503. number_format(Cracks),
  1504. number_format(BackpackInfo[index][bCrack]),
  1505. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CRACK)),
  1506. GetBackpackSize(index),
  1507. number_format(BackpackInfo[index][bCrack]),
  1508. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CRACK))
  1509. );
  1510. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1511. return 1;
  1512. }
  1513. format(rpstring, sizeof(rpstring), "Take's out some cracks and put it in his %s", GetPlayerStorageType(playerid));
  1514. cmd_me(playerid, rpstring);
  1515. PlayerInfo[playerid][pCrack] -= Cracks;
  1516. BackpackInfo[index][bCrack] += Cracks;
  1517. OnPlayerStatsUpdate(playerid);
  1518. return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack"), DeletePVar(playerid, "Type_Action");
  1519. }
  1520. case 3: // Mats
  1521. {
  1522. if(!IsNumeric(inputtext))
  1523. {
  1524. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Mats in your %s", GetBackpackSize(index));
  1525. format(bpstring, sizeof(bpstring)," \
  1526. WARNING: That's not a number!\n\n\
  1527. Input the amount of Mats that you will put in your %s (%s / %s)",
  1528. GetBackpackSize(index),
  1529. number_format(BackpackInfo[index][bMats]),
  1530. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_MATS))
  1531. );
  1532. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1533. return 1;
  1534. }
  1535. new Mats = strval(inputtext);
  1536. if(Mats < 1)
  1537. {
  1538. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Mats in your %s", GetBackpackSize(index));
  1539. format(bpstring, sizeof(bpstring)," \
  1540. WARNING: Must not be 0 or a Negative value!\n\n\
  1541. Input the amount of Mats that you will put in your %s (%s / %s)",
  1542. GetBackpackSize(index),
  1543. number_format(BackpackInfo[index][bMats]),
  1544. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_MATS))
  1545. );
  1546. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1547. return 1;
  1548. }
  1549. if(PlayerInfo[playerid][pMaterials] < Mats)
  1550. {
  1551. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Mats in your %s", GetBackpackSize(index));
  1552. format(bpstring, sizeof(bpstring)," \
  1553. WARNING: You don't have enough %sg Mats to put\n\n\
  1554. Input the amount of Mats that you will put in your %s (%s / %s)",
  1555. number_format(Mats),
  1556. GetBackpackSize(index),
  1557. number_format(BackpackInfo[index][bMats]),
  1558. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_MATS))
  1559. );
  1560. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1561. return 1;
  1562. }
  1563. if((BackpackInfo[index][bMats]+Mats) > BackpackLimit(BackpackInfo[index][bBackpackSize] , LIMIT_MATS))
  1564. {
  1565. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Pots in your %s", GetBackpackSize(index));
  1566. format(bpstring, sizeof(bpstring)," \
  1567. WARNING: %sg cannot be put,Mats in your Backpack is on Maximum Limit (%sg/%sg)\n\n\
  1568. Input the amount of Mats that you will put in your %s (%sg / %sg)",
  1569. number_format(Mats),
  1570. number_format(BackpackInfo[index][bMats]),
  1571. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_MATS)),
  1572. GetBackpackSize(index),
  1573. number_format(BackpackInfo[index][bMats]),
  1574. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_MATS))
  1575. );
  1576. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1577. return 1;
  1578. }
  1579. format(rpstring, sizeof(rpstring), "Take's out some mats and put it in his %s", GetPlayerStorageType(playerid));
  1580. cmd_me(playerid, rpstring);
  1581. PlayerInfo[playerid][pMaterials] -= Mats;
  1582. BackpackInfo[index][bMats] += Mats;
  1583. OnPlayerStatsUpdate(playerid);
  1584. return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack"), DeletePVar(playerid, "Type_Action");
  1585. }
  1586. }
  1587. }
  1588. case 2: // Take Items
  1589. {
  1590. switch(GetPVarInt(playerid, "Listitem_Backpack"))
  1591. {
  1592. case 0: // Cash
  1593. {
  1594. if(!IsNumeric(inputtext))
  1595. {
  1596. format(titlestring, sizeof(titlestring), "{FFFFFF}Taking a Cash in your %s", GetBackpackSize(index));
  1597. format(bpstring, sizeof(bpstring)," \
  1598. WARNING: That's not a number!\n\n\
  1599. Input the amount of Cash that you will take from your %s ($%s / $%s)",
  1600. GetBackpackSize(index),
  1601. number_format(BackpackInfo[index][bCash]),
  1602. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CASH))
  1603. );
  1604. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Take", "Back");
  1605. return 1;
  1606. }
  1607. new amount = strval(inputtext);
  1608. if(amount < 1)
  1609. {
  1610. format(titlestring, sizeof(titlestring), "{FFFFFF}Taking a Cash in your %s", GetBackpackSize(index));
  1611. format(bpstring, sizeof(bpstring)," \
  1612. WARNING: Must not be 0 or a Negative value!\n\n\
  1613. Input the amount of Cash that you will take from your %s ($%s / $%s)",
  1614. GetBackpackSize(index),
  1615. number_format(BackpackInfo[index][bCash]),
  1616. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CASH))
  1617. );
  1618. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Take", "Back");
  1619. return 1;
  1620. }
  1621. if(BackpackInfo[index][bCash] < amount)
  1622. {
  1623. format(titlestring, sizeof(titlestring), "{FFFFFF}Taking a Cash in your %s", GetBackpackSize(index));
  1624. format(bpstring, sizeof(bpstring)," \
  1625. WARNING: You don't have enough $%s Cash in your Backpack!\n\n\
  1626. Input the amount of Cash that you will take from your %s ($%s / $%s)",
  1627. number_format(amount),
  1628. GetBackpackSize(index),
  1629. number_format(BackpackInfo[index][bCash]),
  1630. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CASH))
  1631. );
  1632. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Take", "Back");
  1633. return 1;
  1634. }
  1635. format(rpstring, sizeof(rpstring), "Take's out some cash from his %s", GetPlayerStorageType(playerid));
  1636. cmd_me(playerid, rpstring);
  1637. GivePlayerCash(playerid, amount);
  1638. BackpackInfo[index][bCash] -= amount;
  1639. OnPlayerStatsUpdate(playerid);
  1640. return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack"), DeletePVar(playerid, "Type_Action");
  1641. }
  1642. case 1: // Pots
  1643. {
  1644. if(!IsNumeric(inputtext))
  1645. {
  1646. format(titlestring, sizeof(titlestring), "{FFFFFF}Taking a Pots in your %s", GetBackpackSize(index));
  1647. format(bpstring, sizeof(bpstring)," \
  1648. WARNING: That's not a number!\n\n\
  1649. Input the amount of Pots that you will take from your %s (%sg / %sg)",
  1650. GetBackpackSize(index),
  1651. number_format(BackpackInfo[index][bPot]),
  1652. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_POT))
  1653. );
  1654. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Take", "Back");
  1655. return 1;
  1656. }
  1657. new amount = strval(inputtext);
  1658. if(amount < 1)
  1659. {
  1660. format(titlestring, sizeof(titlestring), "{FFFFFF}Taking a Pots in your %s", GetBackpackSize(index));
  1661. format(bpstring, sizeof(bpstring)," \
  1662. WARNING: Must not be 0 or a Negative value!\n\n\
  1663. Input the amount of Pots that you will take from your %s (%sg / %sg)",
  1664. GetBackpackSize(index),
  1665. number_format(BackpackInfo[index][bPot]),
  1666. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_POT))
  1667. );
  1668. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Take", "Back");
  1669. return 1;
  1670. }
  1671. if(BackpackInfo[index][bPot] < amount)
  1672. {
  1673. format(titlestring, sizeof(titlestring), "{FFFFFF}Taking a Pots in your %s", GetBackpackSize(index));
  1674. format(bpstring, sizeof(bpstring)," \
  1675. WARNING: You don't have enough %sg Pots in your Backpack!\n\n\
  1676. Input the amount of Pots that you will take from your %s (%sg / %sg)",
  1677. number_format(amount),
  1678. GetBackpackSize(index),
  1679. number_format(BackpackInfo[index][bPot]),
  1680. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_POT))
  1681. );
  1682. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Take", "Back");
  1683. return 1;
  1684. }
  1685. format(rpstring, sizeof(rpstring), "Take's out some pots from his %s", GetPlayerStorageType(playerid));
  1686. cmd_me(playerid, rpstring);
  1687. PlayerInfo[playerid][pWeed] += amount;
  1688. BackpackInfo[index][bPot] -= amount;
  1689. OnPlayerStatsUpdate(playerid);
  1690. return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack"), DeletePVar(playerid, "Type_Action");
  1691. }
  1692. case 2: // Cracks
  1693. {
  1694. if(!IsNumeric(inputtext))
  1695. {
  1696. format(titlestring, sizeof(titlestring), "{FFFFFF}Taking a Cracks in your %s", GetBackpackSize(index));
  1697. format(bpstring, sizeof(bpstring)," \
  1698. WARNING: That's not a number!\n\n\
  1699. Input the amount of Cracks that you will take from your %s (%sg / %sg)",
  1700. GetBackpackSize(index),
  1701. number_format(BackpackInfo[index][bCrack]),
  1702. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CRACK))
  1703. );
  1704. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Take", "Back");
  1705. return 1;
  1706. }
  1707. new amount = strval(inputtext);
  1708. if(amount < 1)
  1709. {
  1710. format(titlestring, sizeof(titlestring), "{FFFFFF}Taking a Cracks in your %s", GetBackpackSize(index));
  1711. format(bpstring, sizeof(bpstring)," \
  1712. WARNING: Must not be 0 or a Negative value!\n\n\
  1713. Input the amount of Cracks that you will take from your %s (%sg / %sg)",
  1714. GetBackpackSize(index),
  1715. number_format(BackpackInfo[index][bCrack]),
  1716. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CRACK))
  1717. );
  1718. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Take", "Back");
  1719. return 1;
  1720. }
  1721. if(BackpackInfo[index][bCrack] < amount)
  1722. {
  1723. format(titlestring, sizeof(titlestring), "{FFFFFF}Taking a Cracks in your %s", GetBackpackSize(index));
  1724. format(bpstring, sizeof(bpstring)," \
  1725. WARNING: You don't have enough %sg Pots in your Backpack!\n\n\
  1726. Input the amount of Cracks that you will take from your %s (%sg / %sg)",
  1727. number_format(amount),
  1728. GetBackpackSize(index),
  1729. number_format(BackpackInfo[index][bCrack]),
  1730. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CRACK))
  1731. );
  1732. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Take", "Back");
  1733. return 1;
  1734. }
  1735. format(rpstring, sizeof(rpstring), "Take's out some cracks from his %s", GetPlayerStorageType(playerid));
  1736. cmd_me(playerid, rpstring);
  1737. PlayerInfo[playerid][pCrack] += amount;
  1738. BackpackInfo[index][bCrack] -= amount;
  1739. OnPlayerStatsUpdate(playerid);
  1740. return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack"), DeletePVar(playerid, "Type_Action");
  1741. }
  1742. case 3: // Mats
  1743. {
  1744. if(!IsNumeric(inputtext))
  1745. {
  1746. format(titlestring, sizeof(titlestring), "{FFFFFF}Taking a Mats in your %s", GetBackpackSize(index));
  1747. format(bpstring, sizeof(bpstring)," \
  1748. WARNING: That's not a number!\n\n\
  1749. Input the amount of Mats that you will take from your %s (%s / %s)",
  1750. GetBackpackSize(index),
  1751. number_format(BackpackInfo[index][bMats]),
  1752. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_MATS))
  1753. );
  1754. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Take", "Back");
  1755. return 1;
  1756. }
  1757. new amount = strval(inputtext);
  1758. if(amount < 1)
  1759. {
  1760. format(titlestring, sizeof(titlestring), "{FFFFFF}Taking a Mats in your %s", GetBackpackSize(index));
  1761. format(bpstring, sizeof(bpstring)," \
  1762. WARNING: Must not be 0 or a Negative value!\n\n\
  1763. Input the amount of Mats that you will take from your %s (%s / %s)",
  1764. GetBackpackSize(index),
  1765. number_format(BackpackInfo[index][bMats]),
  1766. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_MATS))
  1767. );
  1768. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Take", "Back");
  1769. return 1;
  1770. }
  1771. if(BackpackInfo[index][bMats] < amount)
  1772. {
  1773. format(titlestring, sizeof(titlestring), "{FFFFFF}Taking a Mats in your %s", GetBackpackSize(index));
  1774. format(bpstring, sizeof(bpstring)," \
  1775. WARNING: You don't have enough %sg Pots in your Backpack!\n\n\
  1776. Input the amount of Mats that you will take from your %s (%s / %s)",
  1777. number_format(amount),
  1778. GetBackpackSize(index),
  1779. number_format(BackpackInfo[index][bMats]),
  1780. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_MATS))
  1781. );
  1782. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Take", "Back");
  1783. return 1;
  1784. }
  1785. format(rpstring, sizeof(rpstring), "Take's out some mats from his %s", GetPlayerStorageType(playerid));
  1786. cmd_me(playerid, rpstring);
  1787. PlayerInfo[playerid][pMaterials] += amount;
  1788. BackpackInfo[index][bMats] -= amount;
  1789. OnPlayerStatsUpdate(playerid);
  1790. return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack"), DeletePVar(playerid, "Type_Action");
  1791. }
  1792. }
  1793. }
  1794. }
  1795. }
  1796. else ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack"), DeletePVar(playerid, "Type_Action");
  1797. }
  1798. case DIALOG_ACTIONBACKPACKMENU:
  1799. {
  1800. if(response)
  1801. {
  1802. new bpstring[230], titlestring[64], index = GetPlayerBackpackID(playerid), rpstring[128];
  1803. switch(listitem)
  1804. {
  1805. case 0: { // Put Items into Backpack
  1806. switch(GetPVarInt(playerid, "Listitem_Backpack")) {
  1807. case 0: {
  1808. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Cash in your %s", GetBackpackSize(index));
  1809. format(bpstring, sizeof(bpstring)," \
  1810. Input the amount of Cash that you will put in your %s ($%s / $%s)",
  1811. GetBackpackSize(index),
  1812. number_format(BackpackInfo[index][bCash]),
  1813. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CASH))
  1814. );
  1815. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1816. SetPVarInt(playerid, "Type_Action", 1);
  1817. }
  1818. case 1: {
  1819. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Pots in your %s", GetBackpackSize(index));
  1820. format(bpstring, sizeof(bpstring)," \
  1821. Input the amount of Pots that you will put in your %s (%sg / %sg)",
  1822. GetBackpackSize(index),
  1823. number_format(BackpackInfo[index][bPot]),
  1824. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_POT))
  1825. );
  1826. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1827. SetPVarInt(playerid, "Type_Action", 1);
  1828. }
  1829. case 2: {
  1830. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Cracks in your %s", GetBackpackSize(index));
  1831. format(bpstring, sizeof(bpstring)," \
  1832. Input the amount of Cracks that you will put in your %s (%sg / %sg)",
  1833. GetBackpackSize(index),
  1834. number_format(BackpackInfo[index][bCrack]),
  1835. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CRACK))
  1836. );
  1837. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1838. SetPVarInt(playerid, "Type_Action", 1);
  1839. }
  1840. case 3: {
  1841. format(titlestring, sizeof(titlestring), "{FFFFFF}Putting a Mats in your %s", GetBackpackSize(index));
  1842. format(bpstring, sizeof(bpstring)," \
  1843. Input the amount of Materials that you will put in your %s (%s / %s)",
  1844. GetBackpackSize(index),
  1845. number_format(BackpackInfo[index][bMats]),
  1846. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_MATS))
  1847. );
  1848. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Put", "Back");
  1849. SetPVarInt(playerid, "Type_Action", 1);
  1850. }
  1851. case 4: {
  1852. new gunid = GetPlayerWeapon(playerid);
  1853. if(!gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You don't have any Gun Equipped"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1854. if(!IsRoleplayWeapon(gunid)) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot put this kind of Weapon in your Backpack"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1855. ////if(PlayerInfo[playerid][pAGuns][GetWeaponSlot(gunid)] == gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot put Admin Weapons in the Backpack!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1856. if(BackpackInfo[index][bGun][0] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "There is already weapon in this Slot!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1857. format(rpstring, sizeof(rpstring), "Put his %s into their %s", GetWeaponNameEx(gunid),GetPlayerStorageType(playerid));
  1858. cmd_me(playerid, rpstring);
  1859. BackpackInfo[index][bGun][0] = gunid;
  1860. RemovePlayerWeapon(playerid, gunid);
  1861. OnPlayerStatsUpdate(playerid);
  1862. return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1863. }
  1864. case 5: {
  1865. new gunid = GetPlayerWeapon(playerid);
  1866. if(!gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You don't have any Gun Equipped"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1867. if(!IsRoleplayWeapon(gunid)) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot put this kind of Weapon in your Backpack"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1868. //if(PlayerInfo[playerid][pAGuns][GetWeaponSlot(gunid)] == gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot put Admin Weapons in the Backpack!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1869. if(BackpackInfo[index][bGun][1] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "There is already weapon in this Slot!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1870. format(rpstring, sizeof(rpstring), "Put his %s into their %s", GetWeaponNameEx(gunid),GetPlayerStorageType(playerid));
  1871. cmd_me(playerid, rpstring);
  1872. BackpackInfo[index][bGun][1] = gunid;
  1873. RemovePlayerWeapon(playerid, gunid);
  1874. OnPlayerStatsUpdate(playerid);
  1875. return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1876. }
  1877. case 6: {
  1878. new gunid = GetPlayerWeapon(playerid);
  1879. if(!gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You don't have any Gun Equipped"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1880. if(!IsRoleplayWeapon(gunid)) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot put this kind of Weapon in your Backpack"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1881. //if(PlayerInfo[playerid][pAGuns][GetWeaponSlot(gunid)] == gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot put Admin Weapons in the Backpack!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1882. if(BackpackInfo[index][bGun][2] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "There is already weapon in this Slot!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1883. format(rpstring, sizeof(rpstring), "Put his %s into their %s", GetWeaponNameEx(gunid),GetPlayerStorageType(playerid));
  1884. cmd_me(playerid, rpstring);
  1885. BackpackInfo[index][bGun][2] = gunid;
  1886. RemovePlayerWeapon(playerid, gunid);
  1887. OnPlayerStatsUpdate(playerid);
  1888. return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1889. }
  1890. case 7: {
  1891. new gunid = GetPlayerWeapon(playerid);
  1892. if(!gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You don't have any Gun Equipped"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1893. if(!IsRoleplayWeapon(gunid)) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot put this kind of Weapon in your Backpack"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1894. //if(PlayerInfo[playerid][pAGuns][GetWeaponSlot(gunid)] == gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot put Admin Weapons in the Backpack!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1895. if(BackpackInfo[index][bGun][3] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "There is already weapon in this Slot!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1896. format(rpstring, sizeof(rpstring), "Put his %s into their %s", GetWeaponNameEx(gunid),GetPlayerStorageType(playerid));
  1897. cmd_me(playerid, rpstring);
  1898. BackpackInfo[index][bGun][3] = gunid;
  1899. RemovePlayerWeapon(playerid, gunid);
  1900. OnPlayerStatsUpdate(playerid);
  1901. return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1902. }
  1903. case 8: {
  1904. new gunid = GetPlayerWeapon(playerid);
  1905. if(!gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You don't have any Gun Equipped"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1906. if(!IsRoleplayWeapon(gunid)) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot put this kind of Weapon in your Backpack"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1907. //if(PlayerInfo[playerid][pAGuns][GetWeaponSlot(gunid)] == gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot put Admin Weapons in the Backpack!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1908. if(BackpackInfo[index][bGun][4] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "There is already weapon in this Slot!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1909. format(rpstring, sizeof(rpstring), "Put his %s into their %s", GetWeaponNameEx(gunid),GetPlayerStorageType(playerid));
  1910. cmd_me(playerid, rpstring);
  1911. BackpackInfo[index][bGun][4] = gunid;
  1912. RemovePlayerWeapon(playerid, gunid);
  1913. OnPlayerStatsUpdate(playerid);
  1914. return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1915. }
  1916. }
  1917. }
  1918. case 1: { // Take Items from the Backpack
  1919. switch(GetPVarInt(playerid, "Listitem_Backpack")) {
  1920. case 0: {
  1921. format(titlestring, sizeof(titlestring), "{FFFFFF}Taking a Cash in your %s", GetBackpackSize(index));
  1922. format(bpstring, sizeof(bpstring)," \
  1923. Input the amount of Cash that you will take from your %s ($%s / $%s)",
  1924. GetBackpackSize(index),
  1925. number_format(BackpackInfo[index][bCash]),
  1926. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CASH))
  1927. );
  1928. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Take", "Back");
  1929. SetPVarInt(playerid, "Type_Action", 2);
  1930. }
  1931. case 1: {
  1932. format(titlestring, sizeof(titlestring), "{FFFFFF}Taking a Pots in your %s", GetBackpackSize(index));
  1933. format(bpstring, sizeof(bpstring)," \
  1934. Input the amount of Pots that you will put from your %s (%sg / %sg)",
  1935. GetBackpackSize(index),
  1936. number_format(BackpackInfo[index][bPot]),
  1937. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_POT))
  1938. );
  1939. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Take", "Back");
  1940. SetPVarInt(playerid, "Type_Action", 2);
  1941. }
  1942. case 2: {
  1943. format(titlestring, sizeof(titlestring), "{FFFFFF}Taking a Cracks in your %s", GetBackpackSize(index));
  1944. format(bpstring, sizeof(bpstring)," \
  1945. Input the amount of Cracks that you will put from your %s (%sg / %sg)",
  1946. GetBackpackSize(index),
  1947. number_format(BackpackInfo[index][bCrack]),
  1948. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_CRACK))
  1949. );
  1950. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Take", "Back");
  1951. SetPVarInt(playerid, "Type_Action", 2);
  1952. }
  1953. case 3: {
  1954. format(titlestring, sizeof(titlestring), "{FFFFFF}Taking a Mats in your %s", GetBackpackSize(index));
  1955. format(bpstring, sizeof(bpstring)," \
  1956. Input the amount of Materials that you will put from your %s (%s / %s)",
  1957. GetBackpackSize(index),
  1958. number_format(BackpackInfo[index][bMats]),
  1959. number_format(BackpackLimit(BackpackInfo[index][bBackpackSize], LIMIT_MATS))
  1960. );
  1961. ShowPlayerDialog(playerid, DIALOG_PUTAKEITEMS, DIALOG_STYLE_INPUT, titlestring, bpstring, "Take", "Back");
  1962. SetPVarInt(playerid, "Type_Action", 2);
  1963. }
  1964. case 4: {
  1965. new gunid = BackpackInfo[index][bGun][0];
  1966. if(!gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You dont have any Weapon in this Slot!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1967. if(PlayerInfo[playerid][pWeapons][GetWeaponSlot(gunid)] == gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You already have this weapon in your hand!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1968. format(rpstring, sizeof(rpstring), "Take his %s from their %s", GetWeaponNameEx(gunid),GetPlayerStorageType(playerid));
  1969. cmd_me(playerid, rpstring);
  1970. GivePlayerWeaponEx(playerid, gunid, 60000);
  1971. BackpackInfo[index][bGun][0] = 0;
  1972. OnPlayerStatsUpdate(playerid);
  1973. ShowPlayerBackpack(playerid);
  1974. DeletePVar(playerid, "Listitem_Backpack");
  1975. return 1;
  1976. }
  1977. case 5: {
  1978. new gunid = BackpackInfo[index][bGun][1];
  1979. if(!gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You dont have any Weapon in this Slot!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1980. if(PlayerInfo[playerid][pWeapons][GetWeaponSlot(gunid)] == gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You already have this weapon in your hand!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1981. format(rpstring, sizeof(rpstring), "Take his %s from their %s", GetWeaponNameEx(gunid),GetPlayerStorageType(playerid));
  1982. cmd_me(playerid, rpstring);
  1983. GivePlayerWeaponEx(playerid, gunid, 60000);
  1984. BackpackInfo[index][bGun][1] = 0;
  1985. OnPlayerStatsUpdate(playerid);
  1986. return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1987. }
  1988. case 6: {
  1989. new gunid = BackpackInfo[index][bGun][2];
  1990. if(!gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You dont have any Weapon in this Slot!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1991. if(PlayerInfo[playerid][pWeapons][GetWeaponSlot(gunid)] == gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You already have this weapon in your hand!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1992. format(rpstring, sizeof(rpstring), "Take his %s from their %s", GetWeaponNameEx(gunid),GetPlayerStorageType(playerid));
  1993. cmd_me(playerid, rpstring);
  1994. GivePlayerWeaponEx(playerid, gunid, 60000);
  1995. BackpackInfo[index][bGun][2] = 0;
  1996. OnPlayerStatsUpdate(playerid);
  1997. return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  1998. }
  1999. case 7: {
  2000. new gunid = BackpackInfo[index][bGun][3];
  2001. if(!gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You dont have any Weapon in this Slot!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  2002. if(PlayerInfo[playerid][pWeapons][GetWeaponSlot(gunid)] == gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You already have this weapon in your hand!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  2003. format(rpstring, sizeof(rpstring), "Take his %s from their %s", GetWeaponNameEx(gunid),GetPlayerStorageType(playerid));
  2004. cmd_me(playerid, rpstring);
  2005. GivePlayerWeaponEx(playerid, gunid, 60000);
  2006. BackpackInfo[index][bGun][3] = 0;
  2007. OnPlayerStatsUpdate(playerid);
  2008. return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  2009. }
  2010. case 8: {
  2011. new gunid = BackpackInfo[index][bGun][4];
  2012. if(!gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You dont have any Weapon in this Slot!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  2013. if(PlayerInfo[playerid][pWeapons][GetWeaponSlot(gunid)] == gunid) return SendClientMessageEx(playerid, COLOR_GREY, "You already have this weapon in your hand!"), ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  2014. format(rpstring, sizeof(rpstring), "Take his %s from their %s", GetWeaponNameEx(gunid),GetPlayerStorageType(playerid));
  2015. cmd_me(playerid, rpstring);
  2016. GivePlayerWeaponEx(playerid, gunid, 60000);
  2017. BackpackInfo[index][bGun][4] = 0;
  2018. OnPlayerStatsUpdate(playerid);
  2019. return ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  2020. }
  2021. }
  2022. }
  2023. }
  2024. }
  2025. else ShowPlayerBackpack(playerid), DeletePVar(playerid, "Listitem_Backpack");
  2026. }
  2027. }
  2028. return 1;
  2029. }
  2030. hook OnPlayerConnect(playerid)
  2031. {
  2032. backpackid[playerid] = MAX_BACKPACKS+1;
  2033. return 1;
  2034. }