fsafes.inc 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. new fsafestr[128];
  2. #define DIALOG_FSAFES_SHOW 15212
  3. #define SAFE_WEAPONS_LIMIT 20
  4. forward LogSafe(playerid, action[128]);
  5. public LogSafe(playerid, action[128])
  6. {
  7. new query[200];
  8. new Year, Month, Day, datestr[32];
  9. getdate(Year, Month, Day);
  10. format(datestr, 32, "%02d/%02d/%d", Month, Day, Year);
  11. mysql_format(sqlGameConnection, query, sizeof(query), "INSERT INTO `familysafelogs`(`Player`, `PlayerSQL`, `Action`, `FamilyID`, `Date`) VALUES ('%e', %d, '%e', %d, '%e')", PlayerName(playerid), PlayerInfo[playerid][pID], action, PlayerInfo[playerid][pFMember], datestr);
  12. mysql_pquery(sqlGameConnection, query, "LogSafeSQL", "sdsds", PlayerName(playerid), PlayerInfo[playerid][pID], action, PlayerInfo[playerid][pFMember], datestr);
  13. return 1;
  14. }
  15. forward LogSafeSQL(name[24], sql, action[128], family, date[32]);
  16. public LogSafeSQL(name[24], sql, action[128], family, date[32])
  17. {
  18. printf("[FAMILY DEBUG] %s (SQL %d, Slot %d): %s", name, sql, family, action);
  19. return 1;
  20. }
  21. CMD:fsafe(playerid, params[])
  22. {
  23. new fam = PlayerInfo[playerid][pFMember];
  24. if(fam == 255) return SendClientMessage(playerid, COLOR_GREY, "You are not a member of a family.");
  25. if(FamilyInfo[fam][FamilySafe] == 0) return SendClientMessage(playerid, COLOR_GRAD2, "Your family does not own a safe.");
  26. if(!IsPlayerInRangeOfPoint(playerid, 2, FamilyInfo[fam][FamilySafePos][0], FamilyInfo[PlayerInfo[playerid][pFMember]][FamilySafePos][1], FamilyInfo[PlayerInfo[playerid][pFMember]][FamilySafePos][2])) return SendClientMessage(playerid, COLOR_GRAD2, "You are not at your Family Safe.");
  27. if(GetPlayerVirtualWorld(playerid) != FamilyInfo[fam][FamilySafeWorld]) return SendClientMessage(playerid, COLOR_GREY, "You are not at your Family Safe.");
  28. new sec[24], thing[24], amount[24];
  29. if(sscanf(params, "s[24]s[24]s[24]", sec, thing, amount)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /fsafe [put/get] [mats/cannabis/meth/cocaine/promethazine/lean/codeine/gun]");
  30. {
  31. if(strcmp(sec, "put", true) == 0)
  32. {
  33. // fput mats
  34. if(strcmp(thing, "mats", true) == 0)
  35. {
  36. if(!IsNumeric(amount)) return SendClientMessage(playerid, COLOR_GREY, "The amount must be a number.");
  37. if(PlayerInfo[playerid][pMats] < strval(amount)) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much materials.");
  38. if(strval(amount) < 1 || strval(amount) > 200000) return SendClientMessage(playerid, COLOR_GREY, "Amount must be between 1 and 50000.");
  39. if(FamilyInfo[fam][FamilyMats] + strval(amount) > 200000) return SendClientMessage(playerid, COLOR_GREY, "Family safe can't hold more than 200,000 materials.");
  40. PlayerInfo[playerid][pMats] -= strval(amount);
  41. FamilyInfo[fam][FamilyMats] += strval(amount);
  42. SaveFamilies();
  43. format(fsafestr, sizeof(fsafestr), "Deposited %d Materials", strval(amount));
  44. LogSafe(playerid, fsafestr);
  45. format(fsafestr, sizeof(fsafestr), "* %s deposits materials into a safe.", PlayerICName(playerid));
  46. ProxDetector(30.0, playerid, fsafestr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  47. }
  48. // fput pot
  49. if(strcmp(thing, "cannabis", true) == 0)
  50. {
  51. if(!IsNumeric(amount)) return SendClientMessage(playerid, COLOR_GREY, "The amount must be a number.");
  52. if(PlayerInfo[playerid][pCannabis] < strval(amount)) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much cannabis.");
  53. if(strval(amount) < 1 || strval(amount) > 1000) return SendClientMessage(playerid, COLOR_GREY, "Amount must be between 1 and 1000.");
  54. if(FamilyInfo[fam][FamilyCannabis] + strval(amount) > 1000) return SendClientMessage(playerid, COLOR_GREY, "Family safe can't hold more than 1000 cannabis.");
  55. PlayerInfo[playerid][pCannabis] -= strval(amount);
  56. FamilyInfo[fam][FamilyCannabis] += strval(amount);
  57. SaveFamilies();
  58. format(fsafestr, sizeof(fsafestr), "Deposited %d Cannabis", strval(amount));
  59. LogSafe(playerid, fsafestr);
  60. format(fsafestr, sizeof(fsafestr), "* %s deposits some cannabis into a safe.", PlayerICName(playerid));
  61. ProxDetector(30.0, playerid, fsafestr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  62. }
  63. // fput meth
  64. if(strcmp(thing, "meth", true) == 0)
  65. {
  66. if(!IsNumeric(amount)) return SendClientMessage(playerid, COLOR_GREY, "The amount must be a number.");
  67. if(PlayerInfo[playerid][pMeth] < strval(amount)) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much meth.");
  68. if(strval(amount) < 1 || strval(amount) > 1000) return SendClientMessage(playerid, COLOR_GREY, "Amount must be between 1 and 1000.");
  69. if(FamilyInfo[fam][FamilyMeth] + strval(amount) > 1000) return SendClientMessage(playerid, COLOR_GREY, "Family safe can't hold more than 1000 meth.");
  70. PlayerInfo[playerid][pMeth] -= strval(amount);
  71. FamilyInfo[fam][FamilyMeth] += strval(amount);
  72. SaveFamilies();
  73. format(fsafestr, sizeof(fsafestr), "Deposited %d Meth", strval(amount));
  74. LogSafe(playerid, fsafestr);
  75. format(fsafestr, sizeof(fsafestr), "* %s deposits some meth into a safe.", PlayerICName(playerid));
  76. ProxDetector(30.0, playerid, fsafestr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  77. }
  78. // fput crack
  79. if(strcmp(thing, "cocaine", true) ==0)
  80. {
  81. if(!IsNumeric(amount)) return SendClientMessage(playerid, COLOR_GREY, "The amount must be a number.");
  82. if(PlayerInfo[playerid][pCocaine] < strval(amount)) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much cocaine.");
  83. if(strval(amount) < 1 || strval(amount) > 1000) return SendClientMessage(playerid, COLOR_GREY, "Amount must be between 1 and 1000.");
  84. if(FamilyInfo[fam][FamilyCocaine] + strval(amount) > 1000) return SendClientMessage(playerid, COLOR_GREY, "Family safe can't hold more than 1000 cocaine.");
  85. PlayerInfo[playerid][pCocaine] -= strval(amount);
  86. FamilyInfo[fam][FamilyCocaine] += strval(amount);
  87. SaveFamilies();
  88. format(fsafestr, sizeof(fsafestr), "Deposited %d Cocaine", strval(amount));
  89. LogSafe(playerid, fsafestr);
  90. format(fsafestr, sizeof(fsafestr), "* %s deposits some cocaine into a safe.", PlayerICName(playerid));
  91. ProxDetector(30.0, playerid, fsafestr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  92. }
  93. // fput promethazine
  94. if(strcmp(thing, "promethazine", true) ==0)
  95. {
  96. if(!IsNumeric(amount)) return SendClientMessage(playerid, COLOR_GREY, "The amount must be a number.");
  97. if(PlayerInfo[playerid][pPromethazine] < strval(amount)) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much promethazine.");
  98. if(strval(amount) < 1 || strval(amount) > 1000) return SendClientMessage(playerid, COLOR_GREY, "Amount must be between 1 and 1000.");
  99. if(FamilyInfo[fam][FamilyPromethazine] + strval(amount) > 1000) return SendClientMessage(playerid, COLOR_GREY, "Family safe can't hold more than 1000 promethazine.");
  100. PlayerInfo[playerid][pPromethazine] -= strval(amount);
  101. FamilyInfo[fam][FamilyPromethazine] += strval(amount);
  102. SaveFamilies();
  103. format(fsafestr, sizeof(fsafestr), "Deposited %d Promethazine", strval(amount));
  104. LogSafe(playerid, fsafestr);
  105. format(fsafestr, sizeof(fsafestr), "* %s deposits some promethazine into a safe.", PlayerICName(playerid));
  106. ProxDetector(30.0, playerid, fsafestr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  107. }
  108. // fput codeine
  109. if(strcmp(thing, "codeine", true) ==0)
  110. {
  111. if(!IsNumeric(amount)) return SendClientMessage(playerid, COLOR_GREY, "The amount must be a number.");
  112. if(PlayerInfo[playerid][pCodeine] < strval(amount)) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much codeine.");
  113. if(strval(amount) < 1 || strval(amount) > 1000) return SendClientMessage(playerid, COLOR_GREY, "Amount must be between 1 and 1000.");
  114. if(FamilyInfo[fam][FamilyCodeine] + strval(amount) > 1000) return SendClientMessage(playerid, COLOR_GREY, "Family safe can't hold more than 1000 codeine.");
  115. PlayerInfo[playerid][pCodeine] -= strval(amount);
  116. FamilyInfo[fam][FamilyCodeine] += strval(amount);
  117. SaveFamilies();
  118. format(fsafestr, sizeof(fsafestr), "Deposited %d Codeine", strval(amount));
  119. LogSafe(playerid, fsafestr);
  120. format(fsafestr, sizeof(fsafestr), "* %s deposits some codeine into a safe.", PlayerICName(playerid));
  121. ProxDetector(30.0, playerid, fsafestr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  122. }
  123. // fput lean
  124. if(strcmp(thing, "lean", true) ==0)
  125. {
  126. if(!IsNumeric(amount)) return SendClientMessage(playerid, COLOR_GREY, "The amount must be a number.");
  127. if(PlayerInfo[playerid][pLean] < strval(amount)) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much lean.");
  128. if(strval(amount) < 1 || strval(amount) > 1000) return SendClientMessage(playerid, COLOR_GREY, "Amount must be between 1 and 1000.");
  129. if(FamilyInfo[fam][FamilyLean] + strval(amount) > 1000) return SendClientMessage(playerid, COLOR_GREY, "Family safe can't hold more than 1000 lean.");
  130. PlayerInfo[playerid][pLean] -= strval(amount);
  131. FamilyInfo[fam][FamilyLean] += strval(amount);
  132. SaveFamilies();
  133. format(fsafestr, sizeof(fsafestr), "Deposited %d Lean", strval(amount));
  134. LogSafe(playerid, fsafestr);
  135. format(fsafestr, sizeof(fsafestr), "* %s deposits some lean into a safe.", PlayerICName(playerid));
  136. ProxDetector(30.0, playerid, fsafestr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  137. }
  138. // fput gun
  139. if(strcmp(thing, "gun", true) ==0)
  140. {
  141. new stored = 0, weapon = GetPlayerWeapon(playerid);
  142. if(strcmp(amount, "colt45", true) == 0)
  143. {
  144. if(FamilyInfo[fam][Colt45] >= SAFE_WEAPONS_LIMIT) return SendClientMessage(playerid, COLOR_GREY, "Your family Colt45 locker is full.");
  145. if(weapon != 22 || HaveWeapon(playerid, weapon) != weapon) return SendClientMessage(playerid, COLOR_GREY, "You are not holding a Colt45.");
  146. FamilyInfo[fam][Colt45]++;
  147. TakePlayerWeapon(playerid, 22);
  148. stored = 1;
  149. }
  150. if(strcmp(amount, "shotgun", true) == 0)
  151. {
  152. if(FamilyInfo[fam][Shotgun] >= SAFE_WEAPONS_LIMIT) return SendClientMessage(playerid, COLOR_GREY, "Your family Shotgun locker is full.");
  153. if(weapon != 25 || HaveWeapon(playerid, weapon) != weapon) return SendClientMessage(playerid, COLOR_GREY, "You are not holding a Shotgun.");
  154. FamilyInfo[fam][Shotgun]++;
  155. TakePlayerWeapon(playerid, 25);
  156. stored = 1;
  157. }
  158. if(strcmp(amount, "mp5", true) == 0)
  159. {
  160. if(FamilyInfo[fam][MP5] >= SAFE_WEAPONS_LIMIT) return SendClientMessage(playerid, COLOR_GREY, "Your family MP5 locker is full.");
  161. if(weapon != 29 || HaveWeapon(playerid, weapon) != weapon) return SendClientMessage(playerid, COLOR_GREY, "You are not holding a MP5.");
  162. FamilyInfo[fam][MP5]++;
  163. TakePlayerWeapon(playerid, 29);
  164. stored = 1;
  165. }
  166. if(strcmp(amount, "ak47", true) == 0)
  167. {
  168. if(FamilyInfo[fam][AK47] >= SAFE_WEAPONS_LIMIT) return SendClientMessage(playerid, COLOR_GREY, "Your family AK47 locker is full.");
  169. if(weapon != 30 || HaveWeapon(playerid, weapon) != weapon) return SendClientMessage(playerid, COLOR_GREY, "You are not holding an AK47.");
  170. FamilyInfo[fam][AK47]++;
  171. TakePlayerWeapon(playerid, 30);
  172. stored = 1;
  173. }
  174. if(strcmp(amount, "m4", true) == 0)
  175. {
  176. if(FamilyInfo[fam][M4] >= SAFE_WEAPONS_LIMIT) return SendClientMessage(playerid, COLOR_GREY, "Your family M4 locker is full.");
  177. if(weapon != 31 || HaveWeapon(playerid, weapon) != weapon) return SendClientMessage(playerid, COLOR_GREY, "You are not holding an M4.");
  178. FamilyInfo[fam][M4]++;
  179. TakePlayerWeapon(playerid, 31);
  180. stored = 1;
  181. }
  182. if(strcmp(amount, "spas12", true) == 0)
  183. {
  184. if(FamilyInfo[fam][SPAS12] >= SAFE_WEAPONS_LIMIT) return SendClientMessage(playerid, COLOR_GREY, "Your family SPAS12 locker is full.");
  185. if(weapon != 27 || HaveWeapon(playerid, weapon) != weapon) return SendClientMessage(playerid, COLOR_GREY, "You are not holding a SPAS12.");
  186. FamilyInfo[fam][SPAS12]++;
  187. TakePlayerWeapon(playerid, 27);
  188. stored = 1;
  189. }
  190. if(strcmp(amount, "rifle", true) == 0)
  191. {
  192. if(FamilyInfo[fam][Rifle] >= SAFE_WEAPONS_LIMIT) return SendClientMessage(playerid, COLOR_GREY, "Your family Rifle locker is full.");
  193. if(weapon != 33 || HaveWeapon(playerid, weapon) != weapon) return SendClientMessage(playerid, COLOR_GREY, "You are not holding a Rifle.");
  194. FamilyInfo[fam][Rifle]++;
  195. TakePlayerWeapon(playerid, 33);
  196. stored = 1;
  197. }
  198. if(strcmp(amount, "deagle", true) == 0)
  199. {
  200. if(FamilyInfo[fam][Deagle] >= SAFE_WEAPONS_LIMIT) return SendClientMessage(playerid, COLOR_GREY, "You family Deagle locker is full.");
  201. if(weapon != 24 || HaveWeapon(playerid, weapon) != weapon) return SendClientMessage(playerid, COLOR_GREY, "You are not holding a Deagle.");
  202. FamilyInfo[fam][Deagle]++;
  203. TakePlayerWeapon(playerid, 24);
  204. stored = 1;
  205. }
  206. if(strcmp(amount, "sniper", true) == 0)
  207. {
  208. if(FamilyInfo[fam][Sniper] >= SAFE_WEAPONS_LIMIT) return SendClientMessage(playerid, COLOR_GREY, "Your family Sniper locker is full.");
  209. if(weapon != 34 || HaveWeapon(playerid, weapon) != weapon) return SendClientMessage(playerid, COLOR_GREY, "You are not holding a Sniper.");
  210. FamilyInfo[fam][Sniper]++;
  211. TakePlayerWeapon(playerid, 34);
  212. stored = 1;
  213. }
  214. if(strcmp(amount, "uzi", true) == 0)
  215. {
  216. if(FamilyInfo[fam][UZI] >= SAFE_WEAPONS_LIMIT) return SendClientMessage(playerid, COLOR_GREY, "Your family UZI locker is full.");
  217. if(weapon != 28 || HaveWeapon(playerid, weapon) != weapon) return SendClientMessage(playerid, COLOR_GREY, "You are not holding an UZI.");
  218. FamilyInfo[fam][UZI]++;
  219. TakePlayerWeapon(playerid, 28);
  220. stored = 1;
  221. }
  222. if(strcmp(amount, "tec9", true) == 0)
  223. {
  224. if(FamilyInfo[fam][TEC9] >= SAFE_WEAPONS_LIMIT) return SendClientMessage(playerid, COLOR_GREY, "Your family TEC9 locker is full.");
  225. if(weapon != 32 || HaveWeapon(playerid, weapon) != weapon) return SendClientMessage(playerid, COLOR_GREY, "You are not holding a TEC9.");
  226. FamilyInfo[fam][TEC9]++;
  227. TakePlayerWeapon(playerid, 32);
  228. stored = 1;
  229. }
  230. if(stored == 1)
  231. {
  232. format(fsafestr, sizeof(fsafestr), "* %s places a %s into a safe.", PlayerICName(playerid), amount);
  233. ProxDetector(30.0, playerid, fsafestr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  234. SaveFamilies();
  235. format(fsafestr, sizeof(fsafestr), "Deposited %s", amount);
  236. LogSafe(playerid, fsafestr);
  237. }
  238. }
  239. }
  240. if(strcmp(sec, "get", true) == 0)
  241. {
  242. if(strcmp(thing, "mats", true) == 0)
  243. {
  244. if(!IsNumeric(amount)) return SendClientMessage(playerid, COLOR_GREY, "The amount must be a number.");
  245. if(PlayerInfo[playerid][pRank] < 5) return SendClientMessage(playerid, COLOR_GREY, "Only rank 5+ is allowed to take family materials.");
  246. if(strval(amount) > FamilyInfo[fam][FamilyMats]) return SendClientMessage(playerid, COLOR_GREY, "Family safe doesn't have that much materials.");
  247. if(strval(amount) < 1 || strval(amount) > 50000) return SendClientMessage(playerid, COLOR_GREY, "Amount must be between 1 and 50000.");
  248. PlayerInfo[playerid][pMats] += strval(amount);
  249. FamilyInfo[fam][FamilyMats] -= strval(amount);
  250. SaveFamilies();
  251. format(fsafestr, sizeof(fsafestr), "Withdrew %d Materials", strval(amount));
  252. LogSafe(playerid, fsafestr);
  253. format(fsafestr, sizeof(fsafestr), "* %s takes some materials from a safe.", PlayerICName(playerid));
  254. ProxDetector(30.0, playerid, fsafestr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  255. return 1;
  256. }
  257. // fget pot
  258. if(strcmp(thing, "cannabis", true) == 0)
  259. {
  260. if(!IsNumeric(amount)) return SendClientMessage(playerid, COLOR_GREY, "The amount must be a number.");
  261. if(PlayerInfo[playerid][pRank] < 4) return SendClientMessage(playerid, COLOR_GREY, "Only rank 5+ is allowed to take family cannabis.");
  262. if(strval(amount) > FamilyInfo[fam][FamilyCannabis]) return SendClientMessage(playerid, COLOR_GREY, "Family safe doesn't have that much cannabis.");
  263. if(strval(amount) < 1 || strval(amount) > 50) return SendClientMessage(playerid, COLOR_GREY, "Amount must be between 1 and 50.");
  264. if(strval(amount) + PlayerInfo[playerid][pCannabis] > 50) return SendClientMessage(playerid, COLOR_GREY, "You can only hold a max of 50 cannabis.");
  265. PlayerInfo[playerid][pCannabis] += strval(amount);
  266. FamilyInfo[fam][FamilyCannabis] -= strval(amount);
  267. SaveFamilies();
  268. format(fsafestr, sizeof(fsafestr), "Withdrew %d Cannabis", strval(amount));
  269. LogSafe(playerid, fsafestr);
  270. format(fsafestr, sizeof(fsafestr), "* %s takes some cannabis from a safe.", PlayerICName(playerid));
  271. ProxDetector(30.0, playerid, fsafestr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  272. return 1;
  273. }
  274. // fget crack
  275. if(strcmp(thing, "cocaine", true) ==0)
  276. {
  277. if(!IsNumeric(amount)) return SendClientMessage(playerid, COLOR_GREY, "The amount must be a number.");
  278. if(PlayerInfo[playerid][pRank] < 4) return SendClientMessage(playerid, COLOR_GREY, "Only rank 5+ is allowed to take family cocaine.");
  279. if(strval(amount) > FamilyInfo[fam][FamilyCocaine]) return SendClientMessage(playerid, COLOR_GREY, "Family safe doesn't have that much cocaine.");
  280. if(strval(amount) < 1 || strval(amount) > 25)SendClientMessage(playerid, COLOR_GREY, "Amount must be between 1 and 25.");
  281. if(strval(amount) + PlayerInfo[playerid][pCocaine] > 25) return SendClientMessage(playerid, COLOR_GREY, "You can only hold a max of 25 cocaine.");
  282. PlayerInfo[playerid][pCocaine] += strval(amount);
  283. FamilyInfo[fam][FamilyCocaine] -= strval(amount);
  284. SaveFamilies();
  285. format(fsafestr, sizeof(fsafestr), "Withdrew %d Cocaine", strval(amount));
  286. LogSafe(playerid, fsafestr);
  287. format(fsafestr, sizeof(fsafestr), "* %s takes some cocaine from a safe.", PlayerICName(playerid));
  288. ProxDetector(30.0, playerid, fsafestr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  289. return 1;
  290. }
  291. if(strcmp(thing, "meth", true) ==0)
  292. {
  293. if(!IsNumeric(amount)) return SendClientMessage(playerid, COLOR_GREY, "The amount must be a number.");
  294. if(PlayerInfo[playerid][pRank] < 4) return SendClientMessage(playerid, COLOR_GREY, "Only rank 5+ is allowed to take family meth.");
  295. if(strval(amount) > FamilyInfo[fam][FamilyMeth]) return SendClientMessage(playerid, COLOR_GREY, "Family safe doesn't have that much meth.");
  296. if(strval(amount) < 1 || strval(amount) > 25)SendClientMessage(playerid, COLOR_GREY, "Amount must be between 1 and 25.");
  297. if(strval(amount) + PlayerInfo[playerid][pMeth] > 25) return SendClientMessage(playerid, COLOR_GREY, "You can only hold a max of 25 meth.");
  298. PlayerInfo[playerid][pMeth] += strval(amount);
  299. FamilyInfo[fam][FamilyMeth] -= strval(amount);
  300. SaveFamilies();
  301. format(fsafestr, sizeof(fsafestr), "Withdrew %d Meth", strval(amount));
  302. LogSafe(playerid, fsafestr);
  303. format(fsafestr, sizeof(fsafestr), "* %s takes some meth from a safe.", PlayerICName(playerid));
  304. ProxDetector(30.0, playerid, fsafestr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  305. return 1;
  306. }
  307. if(strcmp(thing, "promethazine", true) ==0)
  308. {
  309. if(!IsNumeric(amount)) return SendClientMessage(playerid, COLOR_GREY, "The amount must be a number.");
  310. if(PlayerInfo[playerid][pRank] < 4) return SendClientMessage(playerid, COLOR_GREY, "Only rank 5+ is allowed to take family promethazine.");
  311. if(strval(amount) > FamilyInfo[fam][FamilyPromethazine]) return SendClientMessage(playerid, COLOR_GREY, "Family safe doesn't have that much promethazine.");
  312. if(strval(amount) < 1 || strval(amount) > 25)SendClientMessage(playerid, COLOR_GREY, "Amount must be between 1 and 25.");
  313. if(strval(amount) + PlayerInfo[playerid][pPromethazine] > 25) return SendClientMessage(playerid, COLOR_GREY, "You can only hold a max of 25 promethazine.");
  314. PlayerInfo[playerid][pPromethazine] += strval(amount);
  315. FamilyInfo[fam][FamilyPromethazine] -= strval(amount);
  316. SaveFamilies();
  317. format(fsafestr, sizeof(fsafestr), "Withdrew %d Promethazine", strval(amount));
  318. LogSafe(playerid, fsafestr);
  319. format(fsafestr, sizeof(fsafestr), "* %s takes some promethazine from a safe.", PlayerICName(playerid));
  320. ProxDetector(30.0, playerid, fsafestr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  321. return 1;
  322. }
  323. if(strcmp(thing, "codeine", true) ==0)
  324. {
  325. if(!IsNumeric(amount)) return SendClientMessage(playerid, COLOR_GREY, "The amount must be a number.");
  326. if(PlayerInfo[playerid][pRank] < 4) return SendClientMessage(playerid, COLOR_GREY, "Only rank 5+ is allowed to take family codeine.");
  327. if(strval(amount) > FamilyInfo[fam][FamilyCodeine]) return SendClientMessage(playerid, COLOR_GREY, "Family safe doesn't have that much codeine.");
  328. if(strval(amount) < 1 || strval(amount) > 25)SendClientMessage(playerid, COLOR_GREY, "Amount must be between 1 and 25.");
  329. if(strval(amount) + PlayerInfo[playerid][pCodeine] > 25) return SendClientMessage(playerid, COLOR_GREY, "You can only hold a max of 25 codeine.");
  330. PlayerInfo[playerid][pCodeine] += strval(amount);
  331. FamilyInfo[fam][FamilyCodeine] -= strval(amount);
  332. SaveFamilies();
  333. format(fsafestr, sizeof(fsafestr), "Withdrew %d Codeine", strval(amount));
  334. LogSafe(playerid, fsafestr);
  335. format(fsafestr, sizeof(fsafestr), "* %s takes some codeine from a safe.", PlayerICName(playerid));
  336. ProxDetector(30.0, playerid, fsafestr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  337. return 1;
  338. }
  339. if(strcmp(thing, "lean", true) ==0)
  340. {
  341. if(!IsNumeric(amount)) return SendClientMessage(playerid, COLOR_GREY, "The amount must be a number.");
  342. if(PlayerInfo[playerid][pRank] < 4) return SendClientMessage(playerid, COLOR_GREY, "Only rank 5+ is allowed to take family lean.");
  343. if(strval(amount) > FamilyInfo[fam][FamilyLean]) return SendClientMessage(playerid, COLOR_GREY, "Family safe doesn't have that much lean.");
  344. if(strval(amount) < 1 || strval(amount) > 25)SendClientMessage(playerid, COLOR_GREY, "Amount must be between 1 and 25.");
  345. if(strval(amount) + PlayerInfo[playerid][pLean] > 25) return SendClientMessage(playerid, COLOR_GREY, "You can only hold a max of 25 lean.");
  346. PlayerInfo[playerid][pLean] += strval(amount);
  347. FamilyInfo[fam][FamilyLean] -= strval(amount);
  348. SaveFamilies();
  349. format(fsafestr, sizeof(fsafestr), "Withdrew %d Lean", strval(amount));
  350. LogSafe(playerid, fsafestr);
  351. format(fsafestr, sizeof(fsafestr), "* %s takes some lean from a safe.", PlayerICName(playerid));
  352. ProxDetector(30.0, playerid, fsafestr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  353. return 1;
  354. }
  355. // fget gun
  356. if(strcmp(thing, "gun", true) ==0)
  357. {
  358. if(PlayerInfo[playerid][pRank] < 2)
  359. return SendClientMessage(playerid, COLOR_GREY, "Only rank 2+ is allowed to take family guns.");
  360. new got = 0;
  361. if(strcmp(amount, "colt45", true) == 0)
  362. {
  363. if(FamilyInfo[fam][Colt45] <= 0) return SendClientMessage(playerid, COLOR_GREY, "Your family Colt45 locker is empty.");
  364. if(HaveWeapon(playerid, 22) == 22) return SendClientMessage(playerid, COLOR_GREY, "You are already holding a Colt45.");
  365. FamilyInfo[fam][Colt45]--;
  366. GivePlayerGun(playerid, 22);
  367. got = 1;
  368. }
  369. if(strcmp(amount, "shotgun", true) == 0)
  370. {
  371. if(FamilyInfo[fam][Shotgun] <= 0) return SendClientMessage(playerid, COLOR_GREY, "Your family Shotgun locker is empty.");
  372. if(HaveWeapon(playerid, 25) == 25) return SendClientMessage(playerid, COLOR_GREY, "You are already holding a Shotgun.");
  373. FamilyInfo[fam][Shotgun]--;
  374. GivePlayerGun(playerid, 25);
  375. got = 1;
  376. }
  377. if(strcmp(amount, "mp5", true) == 0)
  378. {
  379. if(FamilyInfo[fam][MP5] <= 0) return SendClientMessage(playerid, COLOR_GREY, "Your family MP5 locker is empty.");
  380. if(HaveWeapon(playerid, 29) == 29) return SendClientMessage(playerid, COLOR_GREY, "You are already holding a MP5.");
  381. FamilyInfo[fam][MP5]--;
  382. GivePlayerGun(playerid, 29);
  383. got = 1;
  384. }
  385. if(strcmp(amount, "ak47", true) == 0)
  386. {
  387. if(FamilyInfo[fam][AK47] <= 0) return SendClientMessage(playerid, COLOR_GREY, "Your family AK47 locker is empty.");
  388. if(HaveWeapon(playerid, 30) == 30) return SendClientMessage(playerid, COLOR_GREY, "You are already holding an AK47.");
  389. FamilyInfo[fam][AK47]--;
  390. GivePlayerGun(playerid, 30);
  391. got = 1;
  392. }
  393. if(strcmp(amount, "m4", true) == 0)
  394. {
  395. if(FamilyInfo[fam][M4] <= 0) return SendClientMessage(playerid, COLOR_GREY, "Your family M4 locker is empty.");
  396. if(HaveWeapon(playerid, 31) == 31) return SendClientMessage(playerid, COLOR_GREY, "You are already holding a M4.");
  397. FamilyInfo[fam][M4]--;
  398. GivePlayerGun(playerid, 31);
  399. got = 1;
  400. }
  401. if(strcmp(amount, "spas12", true) == 0)
  402. {
  403. if(FamilyInfo[fam][SPAS12] <= 0) return SendClientMessage(playerid, COLOR_GREY, "Your family SPAS12 locker is empty.");
  404. if(HaveWeapon(playerid, 27) == 27) return SendClientMessage(playerid, COLOR_GREY, "You are already holding a SPAS12.");
  405. FamilyInfo[fam][SPAS12]--;
  406. GivePlayerGun(playerid, 27);
  407. got = 1;
  408. }
  409. if(strcmp(amount, "rifle", true) == 0)
  410. {
  411. if(FamilyInfo[fam][Rifle] <= 0) return SendClientMessage(playerid, COLOR_GREY, "Your family Rifle locker is empty.");
  412. if(HaveWeapon(playerid, 33) == 33) return SendClientMessage(playerid, COLOR_GREY, "You are already holding a Rifle.");
  413. FamilyInfo[fam][Rifle]--;
  414. GivePlayerGun(playerid, 33);
  415. got = 1;
  416. }
  417. if(strcmp(amount, "sniper", true) == 0)
  418. {
  419. if(FamilyInfo[fam][Sniper] <= 0) return SendClientMessage(playerid, COLOR_GREY, "Your family Sniper locker is empty.");
  420. if(HaveWeapon(playerid, 34) == 34) return SendClientMessage(playerid, COLOR_GREY, "You are already holding a Sniper.");
  421. FamilyInfo[fam][Sniper]--;
  422. GivePlayerGun(playerid, 34);
  423. got = 1;
  424. }
  425. if(strcmp(amount, "deagle", true) == 0)
  426. {
  427. if(FamilyInfo[fam][Deagle] <= 0) return SendClientMessage(playerid, COLOR_GREY, "Your family Deagle locker is empty.");
  428. if(HaveWeapon(playerid, 24) == 24) return SendClientMessage(playerid, COLOR_GREY, "You are already holding a Deagle.");
  429. FamilyInfo[fam][Deagle]--;
  430. GivePlayerGun(playerid, 24);
  431. got = 1;
  432. }
  433. if(strcmp(amount, "uzi", true) == 0)
  434. {
  435. if(FamilyInfo[fam][UZI] <= 0) return SendClientMessage(playerid, COLOR_GREY, "Your family UZI locker is empty.");
  436. if(HaveWeapon(playerid, 28) == 28) return SendClientMessage(playerid, COLOR_GREY, "You are already holding an UZI.");
  437. FamilyInfo[fam][UZI]--;
  438. GivePlayerGun(playerid, 28);
  439. got = 1;
  440. }
  441. if(strcmp(amount, "tec9", true) == 0)
  442. {
  443. if(FamilyInfo[fam][TEC9] <= 0) return SendClientMessage(playerid, COLOR_GREY, "Your family TEC9 locker is empty.");
  444. if(HaveWeapon(playerid, 32) == 32) return SendClientMessage(playerid, COLOR_GREY, "You are already holding a TEC9.");
  445. FamilyInfo[fam][TEC9]--;
  446. GivePlayerGun(playerid, 32);
  447. got = 1;
  448. }
  449. if(got == 1)
  450. {
  451. format(fsafestr, sizeof(fsafestr), "* %s takes a %s from a safe.", PlayerICName(playerid), amount);
  452. ProxDetector(30.0, playerid, fsafestr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  453. SaveFamilies();
  454. format(fsafestr, sizeof(fsafestr), "Withdrew %s", amount);
  455. LogSafe(playerid, fsafestr);
  456. }
  457. return 1;
  458. }
  459. }
  460. }
  461. return 1;
  462. }
  463. CMD:myfamlogs(playerid, params[])
  464. {
  465. if(PlayerInfo[playerid][pFMember] == 255) return SendClientMessage(playerid, COLOR_GREY, "You are not in a family.");
  466. if(PlayerInfo[playerid][pRank] < 5) return SendClientMessage(playerid, COLOR_GREY, "Only R5+ can use this.");
  467. new query[128];
  468. mysql_format(sqlGameConnection, query, sizeof(query), "SELECT * FROM `familysafelogs` WHERE `FamilyID`= %d ORDER BY `ID` DESC LIMIT 40", PlayerInfo[playerid][pFMember]);
  469. mysql_pquery(sqlGameConnection, query, "FamilySLogs", "d", playerid);
  470. return 1;
  471. }
  472. forward FamilySLogs(playerid);
  473. public FamilySLogs(playerid)
  474. {
  475. new rows = cache_num_rows();
  476. if(!rows) return SendClientMessage(playerid, COLOR_GREY, "No safe actions to display.");
  477. new familysstr[4096], headers[] = "Player\tAction\tDate\n";
  478. for(new i = 0; i < rows; i++)
  479. {
  480. new name[24], date[32], action[128];
  481. cache_get_field_content(i, "Player", name);
  482. cache_get_field_content(i, "Date", date);
  483. cache_get_field_content(i, "Action", action);
  484. format(familysstr, sizeof(familysstr), "%s%s\t%s\t%s\n", familysstr, name, action, date);
  485. }
  486. format(familysstr, sizeof(familysstr), "%s%s", headers, familysstr);
  487. ShowPlayerDialog(playerid, DIALOG_FSAFES_SHOW, DIALOG_STYLE_TABLIST_HEADERS, "My Family Safe Logs", familysstr, "Done", "");
  488. return 1;
  489. }