1
0

gangrobbery.pwn 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Next Generation Gaming, LLC
  11. (created by Next Generation Gaming Development Team)
  12. Developers:
  13. - Jingles
  14. * Copyright (c) 2016, Next Generation Gaming, LLC
  15. *
  16. * All rights reserved.
  17. *
  18. * Redistribution and use in source and binary forms, with or without modification,
  19. * are not permitted in any case.
  20. *
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  25. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  26. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  27. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  28. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  29. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  30. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  31. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  32. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. */
  34. #include <YSI\y_hooks>
  35. /*
  36. enum {
  37. DIALOG_SAFE_CREATE,
  38. DIALOG_SAFE_CTYPEID,
  39. DIALOG_SAFE_CTYPE,
  40. DIALOG_SAFE_CTYPEID_CONFIRM,
  41. DIALOG_SAFE_CMODELID,
  42. DIALOG_SAFE_CMODELID_CONFIRM,
  43. DIALOG_SAFE_MAIN,
  44. DIALOG_SAFE_BALANCE,
  45. DIALOG_SAFE_WITHDRAW,
  46. DIALOG_SAFE_DEPOSIT,
  47. DIALOG_SAFE_PIN,
  48. DIALOG_SAFE_PIN_EDIT,
  49. DIALOG_SAFE_PIN_AEDIT,
  50. DIALOG_SAFE_BREACH,
  51. DIALOG_ROBBERY_SAFE
  52. };
  53. */
  54. hook OnGameModeExit()
  55. {
  56. DeleteGVar("RobbedSafeID");
  57. DeleteGVar("RobberyStage");
  58. DeleteGVar("RobberyPlayerID");
  59. stopRobbery();
  60. for(new i; i < MAX_SAFES; i++)
  61. {
  62. destroyMoneyBag(i);
  63. destroySafe(i);
  64. }
  65. return 1;
  66. }
  67. hook OnPlayerDisconnect(playerid)
  68. {
  69. dropBag(playerid);
  70. DeletePVar(playerid, "_RobbingSafe");
  71. DeletePVar(playerid, "_RobberID");
  72. DeletePVar(playerid, "_CollectTimer");
  73. DeletePVar(playerid, "_CollectedMoney");
  74. return 1;
  75. }
  76. hook OnPlayerPickUpDynamicPickup(playerid, pickupid)
  77. {
  78. if(pickupid == GetGVarInt("RobberyDeliverPickupID") && GetPVarInt(playerid, "_HasBag"))
  79. {
  80. new str[128],
  81. collected = GetPVarInt(playerid, "_CollectedMoney");
  82. DisablePlayerCheckpoint(playerid);
  83. format(str, sizeof(str), "Heist successful! $%s has been succesfully transferred to your safe!", number_format(collected));
  84. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, str);
  85. arrGroupData[PlayerInfo[playerid][pMember]][g_iBudget] += collected;
  86. RemovePlayerAttachedObject(playerid, 8);
  87. RemovePlayerAttachedObject(playerid, 9);
  88. DeletePVar(playerid, "_CollectedMoney");
  89. DeletePVar(playerid, "_HasBag");
  90. }
  91. if(pickupid == GetGVarInt("RobberyEntrancePickupID") && GetPVarInt(playerid, "_RobberyBeacon"))
  92. {
  93. DisablePlayerCheckpoint(playerid);
  94. SetTimerEx("OnRobberyEnterBeacon", 5000, false, "i", playerid);
  95. SendClientMessageEx(playerid, COLOR_GRAD1, "You are now invulnerable for 5 seconds.");
  96. }
  97. }
  98. hook OnPlayerEnterCheckpoint(playerid)
  99. {
  100. if(GetGVarInt("RobberyStage") == 2 && GetSafeID(playerid) > -1)
  101. {
  102. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "Use /robsafe to open the safe. Press F to attempt to crack the code.");
  103. DisablePlayerCheckpoint(playerid);
  104. }
  105. }
  106. /*
  107. hook OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
  108. {
  109. if(GetPVarInt(playerid, "_RobberyBeacon"))
  110. {
  111. new Float:armour,
  112. Float:health;
  113. GetArmour(playerid, armour);
  114. if(armour > 0.0) SetArmour(playerid, armour+amount);
  115. else SetHealth(playerid, health+amount);
  116. }
  117. return 1;
  118. }
  119. */
  120. hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  121. if(arrAntiCheat[playerid][ac_iFlags][AC_DIALOGSPOOFING] > 0) return 1;
  122. switch(dialogid)
  123. {
  124. case DIALOG_ROBBERY_SETUP:
  125. {
  126. if(!response) return 1;
  127. switch(listitem)
  128. {
  129. case 0: ShowPlayerDialogEx(playerid, DIALOG_ROBBERY_SETUP_PERC, DIALOG_STYLE_INPUT, "Robbery Setup | Robable Percentage", "Enter the percentage that's takeable by the robbers.", "Cancel", "Confirm");
  130. case 1: ShowPlayerDialogEx(playerid, DIALOG_ROBBERY_SETUP_RATE, DIALOG_STYLE_INPUT, "Robbery Setup | Collect Rate", "Enter the amount of money taken each 10 seconds.", "Cancel", "Confirm");
  131. case 2: ShowPlayerDialogEx(playerid, DIALOG_ROBBERY_SETUP_MIN, DIALOG_STYLE_INPUT, "Robbery Setup | Minimum Robbers", "Enter the minimum amount of robbers needed in the robbery.", "Cancel", "Confirm");
  132. }
  133. return 1;
  134. }
  135. case DIALOG_ROBBERY_SETUP_PERC:
  136. {
  137. if(response && !isnull(inputtext) && strval(inputtext) <= 100)
  138. ROB_MAX_PERCENTAGE = strval(inputtext);
  139. return cmd_editrobbery(playerid, "");
  140. }
  141. case DIALOG_ROBBERY_SETUP_RATE:
  142. {
  143. if(response && !isnull(inputtext))
  144. ROB_COLLECT_RATE = strval(inputtext);
  145. return cmd_editrobbery(playerid, "");
  146. }
  147. case DIALOG_ROBBERY_SETUP_MIN:
  148. {
  149. if(response && !isnull(inputtext) && strval(inputtext) > 0)
  150. ROB_MIN_MEMBERS = strval(inputtext);
  151. return cmd_editrobbery(playerid, "");
  152. }
  153. case DIALOG_SAFE_PIN:
  154. {
  155. if(response && !isnull(inputtext))
  156. {
  157. if(!strcmp(inputtext, SafeData[GetSafeID(playerid)][g_iPin], true))
  158. {
  159. return safeMenu(playerid);
  160. }
  161. else return SendClientMessageEx(playerid, COLOR_LIGHTRED, "Wrong PIN.");
  162. }
  163. }
  164. case DIALOG_SAFE_MAIN:
  165. {
  166. if(!response) return 1;
  167. new szTitle[64],
  168. szDialog[256],
  169. iSafeID = GetPVarInt(playerid, "_EditingSafeID"),
  170. iTypeID = SafeData[iSafeID][g_iTypeID];
  171. switch(SafeData[iSafeID][g_iType])
  172. {
  173. case 0:
  174. {
  175. format(szTitle, sizeof(szTitle), "(ID: %i) UNSPECIFIED Safe", iSafeID);
  176. format(szDialog, sizeof(szDialog), "_________________________________\n\n--------------------\n Balance Sheet\n--------------------\n%s\n\nVault balance: $%s\n\n_________________________", "UNSPECIFIED", number_format(SafeData[iSafeID][g_iMoney]));
  177. }
  178. case 1:
  179. {
  180. format(szTitle, sizeof(szTitle), "(ID: %i) Bank Safe", iSafeID);
  181. format(szDialog, sizeof(szDialog), "_________________________________\n\n--------------------\n Balance Sheet\n--------------------\nState Bank\n\nVault balance: $%s\n\n_________________________", number_format(SafeData[iSafeID][g_iMoney]));
  182. }
  183. case 2:
  184. {
  185. format(szTitle, sizeof(szTitle), "(ID: %i) {%s}%s's Safe", iSafeID, Group_NumToDialogHex(arrGroupData[iTypeID][g_hDutyColour]), arrGroupData[iTypeID][g_szGroupName]);
  186. format(szDialog, sizeof(szDialog), "_________________________________\n\n--------------------\n Balance Sheet\n--------------------\n%s\n\nVault balance: $%s\n\n_________________________", arrGroupData[iTypeID][g_szGroupName], number_format(SafeData[iSafeID][g_iMoney]));
  187. }
  188. case 3:
  189. {
  190. format(szTitle, sizeof(szTitle), "(ID: %i) %s's Safe Menu", iSafeID, Businesses[iTypeID][bName]);
  191. format(szDialog, sizeof(szDialog), "_________________________________\n\n--------------------\n Balance Sheet\n--------------------\n%s\n\nVault balance: $%s\n\n_________________________", Businesses[iTypeID][bName], number_format(SafeData[iSafeID][g_iMoney]));
  192. }
  193. case 4:
  194. {
  195. format(szTitle, sizeof(szTitle), "(ID: %i) Player Safe Menu", iSafeID);
  196. format(szDialog, sizeof(szDialog), "_________________________________\n\n--------------------\nBalance Sheet\n--------------------\nPlayer\n\nVault balance: $%s\n\n_________________________________", number_format(SafeData[iSafeID][g_iMoney]));
  197. }
  198. }
  199. switch(listitem)
  200. {
  201. case 0:
  202. {
  203. ShowPlayerDialogEx(playerid, DIALOG_SAFE_BALANCE, DIALOG_STYLE_MSGBOX, szTitle, szDialog, "---", "---");
  204. }
  205. case 1:
  206. {
  207. return ShowPlayerDialogEx(playerid, DIALOG_SAFE_WITHDRAW, DIALOG_STYLE_INPUT, szTitle, "Specify the amount you would like to withdraw", "Cancel", "Withdraw");
  208. }
  209. case 2:
  210. {
  211. return ShowPlayerDialogEx(playerid, DIALOG_SAFE_DEPOSIT, DIALOG_STYLE_INPUT, szTitle, "Specify the amount you would like to deposit.", "Cancel", "Deposit");
  212. }
  213. case 3:
  214. {
  215. return ShowPlayerDialogEx(playerid, DIALOG_SAFE_PIN_EDIT, DIALOG_STYLE_INPUT, szTitle, "Please edit the new PIN.", "Back", "Proceed");
  216. }
  217. }
  218. }
  219. case DIALOG_SAFE_BALANCE: return safeMenu(playerid);
  220. case DIALOG_SAFE_WITHDRAW:
  221. {
  222. if(!response || isnull(inputtext)) return safeMenu(playerid);
  223. {
  224. new iSafeID = GetPVarInt(playerid, "_EditingSafeID");
  225. if(!checkSafePerms(playerid)) return SendClientMessageEx(playerid, COLOR_GRAD1, "You must own this safe to withdraw money from it.");
  226. if(SafeData[iSafeID][g_iMoney] < strval(inputtext)) return SendClientMessageEx(playerid, COLOR_GRAD1, "There is not enough money in the safe.");
  227. SafeData[iSafeID][g_iMoney] = SafeData[iSafeID][g_iMoney] - strval(inputtext);
  228. GivePlayerCash(playerid, strval(inputtext));
  229. saveSafe(iSafeID);
  230. DeletePVar(playerid, "_EditingSafeID");
  231. return safeMenu(playerid);
  232. }
  233. }
  234. case DIALOG_SAFE_DEPOSIT:
  235. {
  236. if(!response) return safeMenu(playerid);
  237. {
  238. new iSafeID = GetPVarInt(playerid, "_EditingSafeID");
  239. if(isnull(inputtext)) return safeMenu(playerid);
  240. if(GetPlayerCash(playerid) < strval(inputtext)) return SendClientMessageEx(playerid, COLOR_GRAD1, "You do not have enough money.");
  241. SafeData[iSafeID][g_iMoney] = SafeData[iSafeID][g_iMoney] + strval(inputtext);
  242. GivePlayerCash(playerid, -strval(inputtext));
  243. saveSafe(iSafeID);
  244. DeletePVar(playerid, "_EditingSafeID");
  245. return safeMenu(playerid);
  246. }
  247. }
  248. case DIALOG_SAFE_PIN_EDIT:
  249. {
  250. if(!response || !IsNumeric(inputtext)) return safeMenu(playerid);
  251. {
  252. if(isnull(inputtext) && strlen(inputtext) != 4) return safeMenu(playerid);
  253. new iSafeID = GetPVarInt(playerid, "_EditingSafeID"),
  254. str[32];
  255. if(!checkSafePerms(playerid)) return SendClientMessageEx(playerid, COLOR_GRAD1, "You must be a group leader to edit the safe's PIN.");
  256. format(SafeData[iSafeID][g_iPin], 5, "%s", inputtext);
  257. format(str, sizeof(str), "Pin changed to: %s", SafeData[iSafeID][g_iPin]);
  258. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, str);
  259. saveSafe(iSafeID);
  260. return safeMenu(playerid);
  261. }
  262. }
  263. case DIALOG_SAFE_CREATE:
  264. {
  265. if(!response) return DeletePVar(playerid, "_EditingSafeID");
  266. switch(listitem)
  267. {
  268. case 0: return ShowPlayerDialogEx(playerid, DIALOG_SAFE_CTYPE, DIALOG_STYLE_LIST, "Safe Menu | Safe Type", "Bank\nGroup\nBusiness\nPlayer", "Cancel", "Select");
  269. case 1: return ShowPlayerDialogEx(playerid, DIALOG_SAFE_CTYPEID, DIALOG_STYLE_INPUT, "Safe Menu | Safe Type ID", "Please specify the ID of the safe's owner.", "Cancel", "Select");
  270. case 2: return ShowPlayerDialogEx(playerid, DIALOG_SAFE_CMODELID_CONFIRM, DIALOG_STYLE_LIST, "Safe Menu | Model Selection", "Big Safe\nMedium Safe\nSmall Safe", "Cancel", "Select");
  271. case 3: return safePosition(playerid, GetPVarInt(playerid, "_EditingSafeID"));
  272. case 4: return ShowPlayerDialogEx(playerid, DIALOG_SAFE_PIN_AEDIT, DIALOG_STYLE_INPUT, "Safe Menu | Edit Safe PIN", "Please edit the new PIN.", "Back", "Proceed");
  273. case 5: { processSafe(GetPVarInt(playerid, "_EditingSafeID")); return DeletePVar(playerid, "_EditingSafeID"); }
  274. }
  275. }
  276. case DIALOG_SAFE_CTYPE:
  277. {
  278. if(!response) return safeEditMenu(playerid);
  279. new iSafeID = GetPVarInt(playerid, "_EditingSafeID");
  280. switch(listitem)
  281. {
  282. case 0: SafeData[iSafeID][g_iType] = 1;
  283. case 1: SafeData[iSafeID][g_iType] = 2;
  284. case 2: SafeData[iSafeID][g_iType] = 3;
  285. case 3: SafeData[iSafeID][g_iType] = 4;
  286. }
  287. processSafe(iSafeID);
  288. saveSafe(iSafeID);
  289. return safeEditMenu(playerid);
  290. }
  291. case DIALOG_SAFE_CTYPEID:
  292. {
  293. if(!response || isnull(inputtext) || !IsNumeric(inputtext)) return safeEditMenu(playerid);
  294. new iSafeID = GetPVarInt(playerid, "_EditingSafeID"),
  295. szDialog[128];
  296. if(SafeData[iSafeID][g_iType] == 0)
  297. {
  298. SendClientMessageEx(playerid, COLOR_LIGHTRED, "Please first set the safe's type.");
  299. return safeEditMenu(playerid);
  300. }
  301. switch(SafeData[iSafeID][g_iType])
  302. {
  303. case 1:
  304. {
  305. format(szDialog, sizeof(szDialog), "You are assigning this Bank safe to: State Bank");
  306. }
  307. case 2:
  308. {
  309. format(szDialog, sizeof(szDialog), "You are assigning this Group safe to: {%s}%s", Group_NumToDialogHex(arrGroupData[strval(inputtext)][g_hDutyColour]), arrGroupData[strval(inputtext)][g_szGroupName]);
  310. }
  311. case 3:
  312. {
  313. format(szDialog, sizeof(szDialog), "You are assigning this Business safe to: %s", Businesses[strval(inputtext)][bName]);
  314. }
  315. case 4:
  316. {
  317. format(szDialog, sizeof(szDialog), "You are assigning this Player safe to: %s", GetPlayerNameEx(strval(inputtext)));
  318. }
  319. }
  320. SetPVarInt(playerid, "_SafeTypeID", strval(inputtext));
  321. ShowPlayerDialogEx(playerid, DIALOG_SAFE_CTYPEID_CONFIRM, DIALOG_STYLE_MSGBOX, "Safe Menu | Confirm Owner", szDialog, "Confirm", "Cancel");
  322. return 1;
  323. }
  324. case DIALOG_SAFE_CMODELID_CONFIRM:
  325. {
  326. if(!response) return safeEditMenu(playerid);
  327. new iSafeID = GetPVarInt(playerid, "_EditingSafeID");
  328. switch(listitem)
  329. {
  330. case 0: { SafeData[iSafeID][g_iModelID] = 19799; processSafe(iSafeID); saveSafe(iSafeID); }
  331. case 1: { SafeData[iSafeID][g_iModelID] = 2197; processSafe(iSafeID); saveSafe(iSafeID); }
  332. case 2: { SafeData[iSafeID][g_iModelID] = 2332; processSafe(iSafeID); saveSafe(iSafeID); }
  333. }
  334. return safeEditMenu(playerid);
  335. }
  336. case DIALOG_SAFE_CTYPEID_CONFIRM:
  337. {
  338. if(!response) return safeEditMenu(playerid);
  339. new iSafeID = GetPVarInt(playerid, "_EditingSafeID"),
  340. iTypeID = GetPVarInt(playerid, "_SafeTypeID"),
  341. str[64];
  342. SafeData[iSafeID][g_iTypeID] = iTypeID;
  343. DeletePVar(playerid, "_SaveTypeID");
  344. processSafe(iSafeID);
  345. saveSafe(iSafeID);
  346. switch(SafeData[iSafeID][g_iType])
  347. {
  348. case 1:
  349. {
  350. format(str, sizeof(str), "Safe assigned to: State Bank");
  351. }
  352. case 2:
  353. {
  354. format(str, sizeof(str), "Safe assigned to: %s", arrGroupData[iTypeID][g_szGroupName]);
  355. }
  356. case 3:
  357. {
  358. format(str, sizeof(str), "Safe assigned to: %s", Businesses[iTypeID][bName]);
  359. }
  360. case 4:
  361. {
  362. format(str, sizeof(str), "Safe assigned to: %s", GetPlayerNameEx(iTypeID));
  363. }
  364. }
  365. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, str);
  366. return safeEditMenu(playerid);
  367. }
  368. case DIALOG_SAFE_PIN_AEDIT:
  369. {
  370. if(!response || !IsNumeric(inputtext)) return safeMenu(playerid);
  371. {
  372. if(isnull(inputtext) && strlen(inputtext) != 4) return safeMenu(playerid);
  373. new iSafeID = GetPVarInt(playerid, "_EditingSafeID"),
  374. str[32];
  375. format(SafeData[iSafeID][g_iPin], 5, "%s", inputtext);
  376. format(str, sizeof(str), "[ADM] Pin changed to: %s", SafeData[iSafeID][g_iPin]);
  377. SendClientMessageEx(playerid, COLOR_YELLOW, str);
  378. saveSafe(iSafeID);
  379. return safeEditMenu(playerid);
  380. }
  381. }
  382. case DIALOG_SAFE_BREACH:
  383. {
  384. if(response)
  385. {
  386. return cmd_robsafe(playerid, "");
  387. }
  388. else
  389. {
  390. return ClearAnimationsEx(playerid);
  391. }
  392. }
  393. case DIALOG_ROBBERY_SAFE:
  394. {
  395. if(response)
  396. {
  397. if(!strcmp(inputtext, SafeData[GetGVarInt("RobbedSafeID")][g_iPin], true))
  398. {
  399. new iSafeID = GetGVarInt("RobbedSafeID"),
  400. str[200],
  401. iTypeID = SafeData[iSafeID][g_iTypeID];
  402. GameTextForPlayer(playerid, "~g~Safe breached!~n~~n~~w~Press ~g~'F' ~w~to start collecting.", 4000, 3);
  403. ClearAnimationsEx(playerid);
  404. SafeData[iSafeID][g_iRobbed] = 1;
  405. SafeData[iSafeID][g_tRobbedTime] = gettime();
  406. switch(SafeData[iSafeID][g_iType])
  407. {
  408. case 0: format(str, sizeof(str), "(ID: %i)\nUNSPECIFIED\n%s", iSafeID);
  409. case 1: format(str, sizeof(str), "(ID: %i)\n State Bank Safe", iSafeID);
  410. case 2: format(str, sizeof(str), "(ID: %i)\nGroup Safe\n%s", iSafeID, arrGroupData[iTypeID][g_szGroupName]);
  411. case 3: format(str, sizeof(str), "(ID: %i)\nBusiness Safe\n%s\nOwner: %s", iSafeID, Businesses[iTypeID][bName], StripUnderscore(Businesses[iTypeID][bOwnerName]));
  412. case 4: format(str, sizeof(str), "(ID: %i)\nPlayer Safe\nOwner: UNSPECIFIED", iSafeID, StripUnderscore(Businesses[iTypeID][bOwnerName]));
  413. }
  414. strins(str, "{FF0000}Robbed", strlen(str)+2, sizeof(str)+20);
  415. if(IsValidDynamicObject(SafeData[iSafeID][g_iObjectID]) && SafeData[iSafeID][g_iModelID] == 2332)
  416. {
  417. DestroyDynamicObject(SafeData[iSafeID][g_iObjectID]);
  418. SafeData[iSafeID][g_iObjectID] = CreateDynamicObject(1829, SafeData[iSafeID][g_fPos][0], SafeData[iSafeID][g_fPos][1], SafeData[iSafeID][g_fPos][2], SafeData[iSafeID][g_fPos][3], SafeData[iSafeID][g_fPos][4],SafeData[iSafeID][g_fPos][5], SafeData[iSafeID][g_iVW], SafeData[iSafeID][g_iInt]);
  419. }
  420. UpdateDynamic3DTextLabelText(SafeData[iSafeID][g_iTextLabel], COLOR_YELLOW, str);
  421. saveSafe(iSafeID);
  422. return 1;
  423. }
  424. else return SendClientMessageEx(playerid, COLOR_LIGHTRED, "Code rejected");
  425. }
  426. }
  427. }
  428. return 0;
  429. }
  430. hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  431. {
  432. if(GetGVarInt("RobberyStage") && !GetPVarInt(playerid, "_RobbingSafe") && newkeys == KEY_SECONDARY_ATTACK)
  433. {
  434. new iSafeID = GetSafeID(playerid);
  435. if(iSafeID != GetGVarInt("RobbedSafeID") || iSafeID == -1) return 1;
  436. if(SafeData[iSafeID][g_iRobbed])
  437. {
  438. startCollectMoney(playerid, iSafeID);
  439. }
  440. else
  441. {
  442. ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 1, 0, 0, 0, 0);
  443. SetPVarInt(playerid, "_RobbingSafe", 1);
  444. breachSafe(playerid, GetGVarInt("RobbedSafeID"));
  445. }
  446. return 1;
  447. }
  448. if(GetPVarInt(playerid, "_RobbingSafe") && newkeys == KEY_SECONDARY_ATTACK)
  449. {
  450. ClearAnimationsEx(playerid);
  451. stopCollectMoney(playerid);
  452. return 1;
  453. }
  454. return 1;
  455. }
  456. GetSafeID(playerid)
  457. {
  458. for(new i; i < MAX_SAFES; i++)
  459. {
  460. if(IsPlayerInRangeOfPoint(playerid, 3.0, SafeData[i][g_fPos][0], SafeData[i][g_fPos][1], SafeData[i][g_fPos][2])) return i;
  461. }
  462. return -1;
  463. }
  464. GetMoneyBagID(playerid)
  465. {
  466. for(new i; i < MAX_ROBBERS; i++)
  467. {
  468. if(IsPlayerInRangeOfPoint(playerid, 3.0, MoneyBagData[i][g_fPos][0], MoneyBagData[i][g_fPos][1], MoneyBagData[i][g_fPos][2])) return i;
  469. }
  470. return -1;
  471. }
  472. safePosition(playerid, iSafeID)
  473. {
  474. if(iSafeID == -1) return 1;
  475. new str[64];
  476. SetPVarInt(playerid, "_EditingSafeID", iSafeID);
  477. SetPVarInt(playerid, "_EditingSafeObjectID", SafeData[iSafeID][g_iObjectID]);
  478. EditDynamicObject(playerid, SafeData[iSafeID][g_iObjectID]);
  479. format(str, sizeof str, "You're editing safe ID %i's position.", iSafeID);
  480. SendClientMessageEx(playerid, COLOR_GRAD1, str);
  481. return 1;
  482. }
  483. safeDelete(playerid, params[])
  484. {
  485. if(PlayerInfo[playerid][pAdmin] >= 1337)
  486. {
  487. new
  488. iSafeID,
  489. str[64];
  490. if(sscanf(params, "i", iSafeID))
  491. return SendClientMessageEx(playerid, 0xFFFFFFFF, "Usage: /deletesafe [safeid]");
  492. if(!(0 <= iSafeID < MAX_SAFES))
  493. return SendClientMessageEx(playerid, 0xFFFFFFFF, "Invalid safe ID specified.");
  494. if(SafeData[iSafeID][g_iDBID] == 0)
  495. return SendClientMessageEx(playerid, 0xFFFFFFFF, "The specified safe ID has not been used.");
  496. format(str, sizeof str, "DELETE FROM `safes` WHERE `safeDBID` = %i", SafeData[iSafeID][g_iDBID]);
  497. mysql_tquery(MainPipeline, str, false, "OnQueryFinish", "i", NO_THREAD);
  498. if(IsValidDynamicObject(SafeData[iSafeID][g_iObjectID]))
  499. destroySafe(iSafeID);
  500. SafeData[iSafeID][g_iDBID] = 0;
  501. SafeData[iSafeID][g_iModelID] = 0;
  502. SafeData[iSafeID][g_iType] = 0;
  503. SafeData[iSafeID][g_iTypeID] = 0;
  504. SafeData[iSafeID][g_iVW] = 0;
  505. SafeData[iSafeID][g_fPos][0] = 0.0;
  506. SafeData[iSafeID][g_fPos][1] = 0.0;
  507. SafeData[iSafeID][g_fPos][2] = 0.0;
  508. SafeData[iSafeID][g_fPos][3] = 0.0;
  509. SafeData[iSafeID][g_fPos][4] = 0.0;
  510. SafeData[iSafeID][g_fPos][5] = 0.0;
  511. SafeData[iSafeID][g_iPin] = "0000";
  512. SafeData[iSafeID][g_iRobbed] = 0;
  513. SafeData[iSafeID][g_tRobbedTime] = 0;
  514. format(str, sizeof str, "You have deleted safe ID %i.", iSafeID);
  515. SendClientMessageEx(playerid, 0xFFFFFFFF, str);
  516. }
  517. return 1;
  518. }
  519. startCollectMoney(playerid, iSafeID)
  520. {
  521. new str[128],
  522. iRobberID = GetPVarInt(playerid, "_RobberID");
  523. format(str, sizeof(str), "Robbing Safe ID: %i", iSafeID);
  524. SendClientMessageEx(playerid, COLOR_WHITE, str);
  525. SetPVarInt(playerid, "_RobbingSafe", 1);
  526. SetTimerEx("collectMoney", 10000, false, "ii", playerid, iSafeID);
  527. ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 1, 0, 0, 0, 0);
  528. RemovePlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 2);
  529. RemovePlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 1);
  530. MoneyBagData[iRobberID][g_iObjectID][0] = SetPlayerAttachedObject(playerid,MAX_PLAYER_ATTACHED_OBJECTS - 2,1550,1,0.059999,-0.245000,0.057000,-4.199984,6.600003,99.299903,1.000000,1.000000,1.000000);
  531. MoneyBagData[iRobberID][g_iObjectID][1] = SetPlayerAttachedObject(playerid,MAX_PLAYER_ATTACHED_OBJECTS - 1,1550,1,0.017999,-0.235000,-0.136999,168.799987,-3.799941,35.799995,1.000000,1.000000,1.000000);
  532. SetPVarInt(playerid, "_HasBag", 1);
  533. GameTextForPlayer(playerid, "~g~Collecting...", 5000, 5);
  534. DisablePlayerCheckpoint(playerid);
  535. if(!GetGVarInt("RobberyDeliverPickupID")) SetGVarInt("RobberyDeliverPickupID", CreateDynamicPickup(1274, 1, arrGroupData[PlayerInfo[playerid][pMember]][g_fGaragePos][0], arrGroupData[PlayerInfo[playerid][pMember]][g_fGaragePos][1], arrGroupData[PlayerInfo[playerid][pMember]][g_fGaragePos][2], 0));
  536. SetPlayerCheckpoint(playerid, arrGroupData[PlayerInfo[playerid][pMember]][g_fGaragePos][0], arrGroupData[PlayerInfo[playerid][pMember]][g_fGaragePos][1], arrGroupData[PlayerInfo[playerid][pMember]][g_fGaragePos][2], 5.0);
  537. }
  538. stopCollectMoney(playerid)
  539. {
  540. DeletePVar(playerid, "_RobbingSafe");
  541. }
  542. forward collectMoney(playerid, iSafeID);
  543. public collectMoney(playerid, iSafeID)
  544. {
  545. if(iSafeID != GetSafeID(playerid))
  546. {
  547. stopCollectMoney(playerid);
  548. return 1;
  549. }
  550. new collected = GetPVarInt(playerid, "_CollectedMoney"),
  551. str[128];
  552. collected += ROB_COLLECT_RATE;
  553. if(collected > SafeData[iSafeID][g_iInitialMoney] * ROB_MAX_PERCENTAGE / 100)
  554. {
  555. stopCollectMoney(playerid);
  556. ClearAnimationsEx(playerid);
  557. return SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "The safe is empty.");
  558. }
  559. new robberid = GetPVarInt(playerid, "_RobberID");
  560. format(str, sizeof(str), "Money Bag: $%S (ID: %i)\nDropped by: %s", number_format(collected), robberid, GetPlayerNameEx(playerid));
  561. if(!IsValidDynamic3DTextLabel(MoneyBagData[robberid][g_iTextLabel]))
  562. {
  563. MoneyBagData[robberid][g_iTextLabel] = CreateDynamic3DTextLabel(str, COLOR_LIGHTBLUE, 0.0, -0.3, 0.0, 10.0, playerid, INVALID_VEHICLE_ID, 1, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  564. }
  565. else Update3DTextLabelText(MoneyBagData[robberid][g_iTextLabel], COLOR_LIGHTBLUE, str);
  566. SetPVarInt(playerid, "_CollectedMoney", collected);
  567. SafeData[iSafeID][g_iMoney] -= collected;
  568. GivePlayerCash(playerid, collected);
  569. format(str, sizeof(str), "You collected $%s from the safe. You now have $%s stored in your bag.", number_format(ROB_COLLECT_RATE), number_format(collected));
  570. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, str);
  571. SetTimerEx("collectMoney", 10000, false, "ii", playerid, iSafeID);
  572. return 1;
  573. }
  574. forward OnRobberyEnterBeacon(playerid);
  575. public OnRobberyEnterBeacon(playerid)
  576. {
  577. DeletePVar(playerid, "_RobberyBeacon");
  578. }
  579. saveSafe(iSafeID) {
  580. if(!(0 <= iSafeID < MAX_SAFES))
  581. return 0;
  582. if(SafeData[iSafeID][g_iDBID] == 0)
  583. return 0;
  584. new
  585. szQuery[512];
  586. format(szQuery, sizeof szQuery, "UPDATE `safes` SET `safeType` = %i, \
  587. `safeTypeID` = %i, \
  588. `safeVW` = %i, \
  589. `safeInt` = %i, \
  590. `safeModel` = %i, \
  591. `safePosX` = %f, \
  592. `safePosY` = %f, \
  593. `safePosZ` = %f, \
  594. `safeRotX` = %f, \
  595. `safeRotY` = %f, \
  596. `safeRotZ` = %f",
  597. SafeData[iSafeID][g_iType],
  598. SafeData[iSafeID][g_iTypeID],
  599. SafeData[iSafeID][g_iVW],
  600. SafeData[iSafeID][g_iInt],
  601. SafeData[iSafeID][g_iModelID],
  602. SafeData[iSafeID][g_fPos][0],
  603. SafeData[iSafeID][g_fPos][1],
  604. SafeData[iSafeID][g_fPos][2],
  605. SafeData[iSafeID][g_fPos][3],
  606. SafeData[iSafeID][g_fPos][4],
  607. SafeData[iSafeID][g_fPos][5]
  608. );
  609. format(szQuery, sizeof szQuery, "%s, `safeMoney` = %i, \
  610. `safePin` = '%s', \
  611. `safeRobbed` = %i, \
  612. `safeRobbedTime` = %i \
  613. WHERE `safeDBID` = %i",
  614. szQuery,
  615. SafeData[iSafeID][g_iMoney],
  616. SafeData[iSafeID][g_iPin],
  617. SafeData[iSafeID][g_iRobbed],
  618. SafeData[iSafeID][g_tRobbedTime],
  619. SafeData[iSafeID][g_iDBID]
  620. );
  621. return mysql_tquery(MainPipeline, szQuery, false, "OnQueryFinish", "i", NO_THREAD);
  622. }
  623. loadSafes() {
  624. printf("[LoadSafes] Loading Safes from database...");
  625. mysql_tquery(MainPipeline, "SELECT * FROM `safes`", true, "onloadSafes", "");
  626. }
  627. forward onloadSafes();
  628. public onloadSafes() {
  629. new
  630. iRows,
  631. iFields,
  632. szResult[64];
  633. cache_get_data(iRows, iFields, MainPipeline);
  634. if(!iRows)
  635. return printf("[LoadSafes] Failed to load any Safes.");
  636. for(new iRow; iRow < iRows; iRow++) {
  637. cache_get_field_content(iRow, "safeDBID", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iDBID] = strval(szResult);
  638. cache_get_field_content(iRow, "safeType", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iType] = strval(szResult);
  639. cache_get_field_content(iRow, "safeTypeID", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iTypeID] = strval(szResult);
  640. cache_get_field_content(iRow, "safeVW", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iVW] = strval(szResult);
  641. cache_get_field_content(iRow, "safeInt", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iVW] = strval(szResult);
  642. cache_get_field_content(iRow, "safeModel", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iModelID] = strval(szResult);
  643. cache_get_field_content(iRow, "safePosX", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][0] = floatstr(szResult);
  644. cache_get_field_content(iRow, "safePosY", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][1] = floatstr(szResult);
  645. cache_get_field_content(iRow, "safePosZ", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][2] = floatstr(szResult);
  646. cache_get_field_content(iRow, "safeRotX", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][3] = floatstr(szResult);
  647. cache_get_field_content(iRow, "safeRotY", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][4] = floatstr(szResult);
  648. cache_get_field_content(iRow, "safeRotZ", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_fPos][5] = floatstr(szResult);
  649. cache_get_field_content(iRow, "safeMoney", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iMoney] = strval(szResult);
  650. cache_get_field_content(iRow, "safePin", SafeData[iRow][g_iPin], MainPipeline, 5);
  651. cache_get_field_content(iRow, "safeRobbed", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_iRobbed] = strval(szResult);
  652. cache_get_field_content(iRow, "safeRobbedTime", szResult, MainPipeline, sizeof szResult); SafeData[iRow][g_tRobbedTime] = strval(szResult);
  653. processSafe(iRow);
  654. }
  655. return printf("[MySQL] Loaded %i Safes from database.", iRows);
  656. }
  657. forward onCreateSafe(iExtraID, iSafeID);
  658. public onCreateSafe(iExtraID, iSafeID)
  659. {
  660. new
  661. iDBID = cache_insert_id();
  662. SafeData[iSafeID][g_iDBID] = iDBID;
  663. processSafe(iSafeID);
  664. new str[64];
  665. format(str, sizeof str, "You have created an Safe using ID %i (DBID: %i).", iSafeID, iDBID);
  666. SendClientMessageEx(iExtraID, 0xFFFFFFFF, str);
  667. return 1;
  668. }
  669. safeMenu(playerid)
  670. {
  671. new szTitle[64],
  672. iSafeID = GetSafeID(playerid);
  673. if(iSafeID == -1) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not near a safe.");
  674. SetPVarInt(playerid, "_EditingSafeID", iSafeID);
  675. format(szTitle, sizeof(szTitle), "%s's Safe Menu (ID: %i)", "test", iSafeID);
  676. ShowPlayerDialogEx(playerid, DIALOG_SAFE_MAIN, DIALOG_STYLE_LIST, szTitle, "Request Balance Sheet\nWithdraw Money\nDeposit Money\nEdit PIN", "Cancel", "Proceed");
  677. return 1;
  678. }
  679. destroySafe(iSafeID)
  680. {
  681. if(IsValidDynamic3DTextLabel(SafeData[iSafeID][g_iTextLabel]))
  682. DestroyDynamic3DTextLabel(SafeData[iSafeID][g_iTextLabel]);
  683. if(IsValidDynamicObject(SafeData[iSafeID][g_iObjectID]))
  684. DestroyDynamicObject(SafeData[iSafeID][g_iObjectID]);
  685. }
  686. destroyMoneyBag(iBagID)
  687. {
  688. if(IsValidDynamic3DTextLabel(MoneyBagData[iBagID][g_iTextLabel]))
  689. DestroyDynamic3DTextLabel(MoneyBagData[iBagID][g_iTextLabel]);
  690. if(IsValidDynamicObject(MoneyBagData[iBagID][g_iObjectID][0]))
  691. DestroyDynamicObject(MoneyBagData[iBagID][g_iObjectID][0]);
  692. if(IsValidDynamicObject(MoneyBagData[iBagID][g_iObjectID][1]))
  693. DestroyDynamicObject(MoneyBagData[iBagID][g_iObjectID][1]);
  694. }
  695. processSafe(iSafeID) {
  696. if(!(0 <= iSafeID < MAX_SAFES))
  697. return 0;
  698. if(SafeData[iSafeID][g_iDBID] == 0)
  699. return 0;
  700. if(SafeData[iSafeID][g_tRobbedTime] != 0 && SafeData[iSafeID][g_tRobbedTime] < (gettime() - 86400 * 2)) SafeData[iSafeID][g_iRobbed] = 0;
  701. if(IsValidDynamicObject(SafeData[iSafeID][g_iObjectID]))
  702. destroySafe(iSafeID);
  703. if(SafeData[iSafeID][g_iModelID] == 2332 && SafeData[iSafeID][g_iRobbed])
  704. {
  705. SafeData[iSafeID][g_iObjectID] = CreateDynamicObject(1829, SafeData[iSafeID][g_fPos][0], SafeData[iSafeID][g_fPos][1], SafeData[iSafeID][g_fPos][2], SafeData[iSafeID][g_fPos][3], SafeData[iSafeID][g_fPos][4],SafeData[iSafeID][g_fPos][5], SafeData[iSafeID][g_iVW], SafeData[iSafeID][g_iInt]);
  706. }
  707. else SafeData[iSafeID][g_iObjectID] = CreateDynamicObject(SafeData[iSafeID][g_iModelID], SafeData[iSafeID][g_fPos][0], SafeData[iSafeID][g_fPos][1], SafeData[iSafeID][g_fPos][2], SafeData[iSafeID][g_fPos][3], SafeData[iSafeID][g_fPos][4],SafeData[iSafeID][g_fPos][5], SafeData[iSafeID][g_iVW], SafeData[iSafeID][g_iInt]);
  708. new str[216],
  709. iTypeID = SafeData[iSafeID][g_iTypeID];
  710. switch(SafeData[iSafeID][g_iType])
  711. {
  712. case 0: format(str, sizeof(str), "{FFFFFF}(ID: %i)\n{FFFF00}UNSPECIFIED\n{FFFFFF}%s", iSafeID);
  713. case 1: format(str, sizeof(str), "{FFFFFF}(ID: %i)\n{FFFF00}Bank Safe", iSafeID, arrGroupData[iTypeID][g_szGroupName]);
  714. case 2: format(str, sizeof(str), "{FFFFFF}(ID: %i)\n{FFFF00}Group Safe\n{%s}%s", iSafeID, Group_NumToDialogHex(arrGroupData[iTypeID][g_hDutyColour]), arrGroupData[iTypeID][g_szGroupName]);
  715. case 3: format(str, sizeof(str), "{FFFFFF}(ID: %i)\n{FFFF00}Business Safe\n{FFFFFF}%s\nOwner: %s", iSafeID, Businesses[iTypeID][bName], StripUnderscore(Businesses[iTypeID][bOwnerName]));
  716. case 4: format(str, sizeof(str), "{FFFFFF}(ID: %i)\n{FFFF00}Player Safe\n{FFFFFF}Owner: UNSPECIFIED", iSafeID, StripUnderscore(Businesses[iTypeID][bOwnerName]));
  717. }
  718. if(SafeData[iSafeID][g_iRobbed]) strins(str, "\n{FF0000}Robbed", strlen(str), sizeof(str)+20);
  719. SafeData[iSafeID][g_iTextLabel] = CreateDynamic3DTextLabel(str, COLOR_YELLOW, SafeData[iSafeID][g_fPos][0], SafeData[iSafeID][g_fPos][1], SafeData[iSafeID][g_fPos][2] + 0.75, 5.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, SafeData[iSafeID][g_iVW], SafeData[iSafeID][g_iInt]);
  720. return 1;
  721. }
  722. safeEditMenu(playerid)
  723. {
  724. new szTitle[64],
  725. iSafeID = GetPVarInt(playerid, "_EditingSafeID");
  726. switch(SafeData[iSafeID][g_iType])
  727. {
  728. case 0: format(szTitle, sizeof(szTitle), "Safe Menu | (NONE)");
  729. case 1: format(szTitle, sizeof(szTitle), "Safe Menu | State Bank (Bank)");
  730. case 2: format(szTitle, sizeof(szTitle), "Safe Menu | {%s}%s", Group_NumToDialogHex(arrGroupData[SafeData[iSafeID][g_iTypeID]][g_hDutyColour]), arrGroupData[SafeData[iSafeID][g_iTypeID]][g_szGroupName]);
  731. case 3: format(szTitle, sizeof(szTitle), "Safe Menu | %s (Business)", Businesses[SafeData[iSafeID][g_iTypeID]][bName]);
  732. case 4: format(szTitle, sizeof(szTitle), "Safe Menu | %s (Player)", GetPlayerNameEx(SafeData[iSafeID][g_iTypeID]));
  733. }
  734. ShowPlayerDialogEx(playerid, DIALOG_SAFE_CREATE, DIALOG_STYLE_LIST, szTitle, "\
  735. Safe Type (Bank / Group / Business)\n\
  736. Safe Type ID\n\
  737. Safe Size\n\
  738. Safe Position\n\
  739. Safe PIN\n\
  740. Finish Safe", "Cancel", "Select");
  741. return 1;
  742. }
  743. safeCreate(playerid)
  744. {
  745. if(PlayerInfo[playerid][pAdmin] >= 1337)
  746. {
  747. new szQuery[512];
  748. for(new i = 0; i < MAX_SAFES; ++i) if(SafeData[i][g_iDBID] == 0)
  749. {
  750. SafeData[i][g_iType] = 0;
  751. SafeData[i][g_iTypeID] = 0;
  752. SafeData[i][g_iModelID] = 2332;
  753. SafeData[i][g_iVW] = GetPlayerVirtualWorld(playerid);
  754. SafeData[i][g_iInt] = GetPlayerInterior(playerid);
  755. SafeData[i][g_iMoney] = 0;
  756. SafeData[i][g_iRobbed] = 0;
  757. SafeData[i][g_tRobbedTime] = 0;
  758. GetPlayerPos(playerid, SafeData[i][g_fPos][0], SafeData[i][g_fPos][1], SafeData[i][g_fPos][2]);
  759. GetPlayerFacingAngle(playerid, SafeData[i][g_fPos][5]);
  760. format(SafeData[i][g_iPin], MAX_PLAYER_NAME, "0000");
  761. format(szQuery, sizeof szQuery, "INSERT INTO `safes` (`safeDBID`, `safeModel`, `safeType`, `safeTypeID`, `safeVW`, `safeINT`, `safePosX`, `safePosY`, `safePosZ`, `safeRotX`, `safeRotY`, `safeRotZ`, \
  762. `safeMoney`, `safePin`, `safeRobbed`, `safeRobbedTime`) VALUES (%i, %i, %i, %i, %i, %i, %f, %f, %f, %f, %f, %f, %i, '%s', %i, %i)",
  763. SafeData[i][g_iDBID],
  764. SafeData[i][g_iModelID],
  765. SafeData[i][g_iType],
  766. SafeData[i][g_iTypeID],
  767. SafeData[i][g_iVW],
  768. SafeData[i][g_iInt],
  769. SafeData[i][g_fPos][0],
  770. SafeData[i][g_fPos][1],
  771. SafeData[i][g_fPos][2],
  772. SafeData[i][g_fPos][3],
  773. SafeData[i][g_fPos][4],
  774. SafeData[i][g_fPos][5],
  775. SafeData[i][g_iMoney],
  776. SafeData[i][g_iPin],
  777. SafeData[i][g_iRobbed],
  778. SafeData[i][g_tRobbedTime]
  779. );
  780. return mysql_tquery(MainPipeline, szQuery, true, "onCreateSafe", "ii", playerid, i);
  781. }
  782. SendClientMessageEx(playerid, 0xFFFFFFFF, "There are no more safe slots available.");
  783. }
  784. return 1;
  785. }
  786. ProxGangMemberCheck(playerid)
  787. {
  788. new str[64],
  789. count;
  790. foreach(new i : Player)
  791. {
  792. if(PlayerInfo[i][pMember] == PlayerInfo[playerid][pMember] && GetPlayerVirtualWorld(i) == GetPlayerVirtualWorld(playerid) && GetPlayerInterior(i) == GetPlayerInterior(playerid))
  793. {
  794. if(count > MAX_ROBBERS)
  795. {
  796. format(str, sizeof(str), "You cannot have more than %i robbers. You now have %i available.", MAX_ROBBERS, count);
  797. SendClientMessageEx(playerid, COLOR_LIGHTRED, str);
  798. }
  799. SetPVarInt(i, "_RobberID", count);
  800. format(str, sizeof(str), "You are now part of the heist. (Robber ID: %i)", count);
  801. SendClientMessageEx(i, COLOR_LIGHTRED, str);
  802. count++;
  803. }
  804. }
  805. if(count >= ROB_MIN_MEMBERS) return 1;
  806. else return 0;
  807. }
  808. IsPlayerGangLeader(playerid)
  809. {
  810. if(PlayerInfo[playerid][pMember] > -1 && PlayerInfo[playerid][pLeader] > -1) return 1;
  811. else return 0;
  812. }
  813. checkRobbery(playerid)
  814. {
  815. new playername[MAX_PLAYER_NAME];
  816. GetPlayerName(playerid, playername, sizeof(playername));
  817. SendClientMessageEx(playerid, COLOR_YELLOW, "Awaiting approval..." );
  818. ABroadCast(COLOR_LIGHTRED, "(Gang Leader) Robbery Request - ((/approve)(/deny)robbery)", 2);
  819. }
  820. initiateRobbery(playerid)
  821. {
  822. if(GetGVarInt("RobberyStage")) return SendClientMessageEx(playerid, COLOR_YELLOW,"A robbery is already taking place.");
  823. new str[MAX_PLAYER_NAME + 64];
  824. format(str, sizeof(str), "* %s initiated the robbery.", GetPlayerNameEx(playerid));
  825. ProxDetector(10.0, playerid, str, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
  826. SetGVarInt("RobberyStage", 1);
  827. OnRobbery(playerid, PlayerInfo[playerid][pMember]);
  828. return 1;
  829. }
  830. denyRobbery(playerid)
  831. {
  832. if(GetGVarInt("RobberyStage")) return SendClientMessageEx(playerid, COLOR_YELLOW,"A robbery is already taking place.");
  833. new str[MAX_PLAYER_NAME + 64];
  834. format(str, sizeof(str), "* %s's robbery request has been denied by an admin.", GetPlayerNameEx(playerid));
  835. ProxDetector(10.0, playerid, str, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
  836. DeleteGVar("RobberyPlayerID");
  837. DeleteGVar("RobbedSafeID");
  838. foreach(new i : Player) if(GetPVarInt(i, "_iRobberyID")) DeletePVar(i, "_RobberID");
  839. return 1;
  840. }
  841. stopRobbery()
  842. {
  843. if(IsValidDynamicPickup(GetGVarInt("RobberyDeliverPickupID")))
  844. DestroyDynamicPickup(GetGVarInt("RobberyDeliverPickupID"));
  845. if(IsValidDynamicPickup(GetGVarInt("RobberyEntrancePickupID")))
  846. DestroyDynamicPickup(GetGVarInt("RobberyEntrancePickupID"));
  847. DeleteGVar("RobbedSafeID");
  848. DeleteGVar("RobberyStage");
  849. DeleteGVar("RobberyPlayerID");
  850. DeleteGVar("RobberyDeliverPickupID");
  851. DeleteGVar("RobberyEntrancePickupID");
  852. foreach(new i : Player)
  853. {
  854. if(GetPVarInt(i, "_RobberID"))
  855. {
  856. RemovePlayerAttachedObject(i, 8);
  857. RemovePlayerAttachedObject(i, 9);
  858. }
  859. DeletePVar(i, "_RobbingSafe");
  860. DeletePVar(i, "_RobberID");
  861. DeletePVar(i, "_CollectTimer");
  862. DeletePVar(i, "_CollectedMoney");
  863. }
  864. for(new i; i < MAX_ROBBERS; i++) destroyMoneyBag(i);
  865. return 1;
  866. }
  867. breachSafe(playerid, iSafeID)
  868. {
  869. new szTitle[32],
  870. szDialog[256];
  871. format(szTitle, sizeof(szTitle), "Safe Breach (ID: %i)", iSafeID);
  872. format(szDialog, sizeof(szDialog), "ee115a\t8df9\t12zfja\n\
  873. %b\t48ff\t00f\n\
  874. 125f\t14k\%b\n\
  875. 150z\335f\teta\n\
  876. 1a0z\t48ff\t00f\n\
  877. %b\t48ff\a64b\n\
  878. 1a0z\t48ff\%b", SafeData[iSafeID][g_iPin][0], SafeData[iSafeID][g_iPin][1], SafeData[iSafeID][g_iPin][2], SafeData[iSafeID][g_iPin][3]);
  879. return ShowPlayerDialogEx(playerid, DIALOG_SAFE_BREACH, DIALOG_STYLE_TABLIST_HEADERS, szTitle, szDialog, "Try Code", "Cancel");
  880. }
  881. forward OnRobbery(playerid, groupid);
  882. public OnRobbery(playerid, groupid)
  883. {
  884. new stage = GetGVarInt("RobberyStage"),
  885. iSafeID = GetGVarInt("RobbedSafeID");
  886. switch(stage)
  887. {
  888. case 1:
  889. {
  890. SetTimerEx("OnRobbery", 60000 * 1, false, "ii", playerid, PlayerInfo[playerid][pMember]);
  891. SetGVarInt("RobberyStage", 2);
  892. new str[128];
  893. format(str, sizeof(str), "Robbing Safe ID: %i", iSafeID);
  894. SendClientMessageEx(playerid, COLOR_WHITE, str);
  895. SafeData[iSafeID][g_iRobberyPickup] = CreateDynamicPickup(1212, 23, SafeData[iSafeID][g_fPos][0], SafeData[iSafeID][g_fPos][1], SafeData[iSafeID][g_fPos][2] + 1.0);
  896. foreach(new giveplayerid : Player) if(GetPVarInt(giveplayerid, "_RobberID"))
  897. SetPlayerCheckpoint(giveplayerid, SafeData[iSafeID][g_fPos][0], SafeData[iSafeID][g_fPos][1], SafeData[iSafeID][g_fPos][2], 2.0);
  898. }
  899. case 2:
  900. {
  901. new szMessage[128];
  902. switch(SafeData[iSafeID][g_iType])
  903. {
  904. case 1: format(szMessage, sizeof(szMessage), "** DISPATCH: All units, there is a robbery at %s. (/rbeacon)", "the bank");
  905. case 2: format(szMessage, sizeof(szMessage), "** DISPATCH: All units, there is a robbery at %s. (/rbeacon)", arrGroupData[SafeData[iSafeID][g_iTypeID]][g_szGroupName]);
  906. case 3: format(szMessage, sizeof(szMessage), "** DISPATCH: All units, there is a robbery at %s. (/rbeacon)", arrGroupData[SafeData[iSafeID][g_iTypeID]][g_szGroupName]);
  907. case 4: format(szMessage, sizeof(szMessage), "** DISPATCH: All units, there is a robbery at %s. (/rbeacon)", Businesses[SafeData[iSafeID][g_iTypeID]][bName]);
  908. case 5: format(szMessage, sizeof(szMessage), "** DISPATCH: All units, there is a robbery at %s's house. (/rbeacon)", "a person");
  909. }
  910. SendGroupMessage(GROUP_TYPE_LEA, COLOR_LIGHTRED, szMessage);
  911. SetGVarInt("RobberyStage", 3);
  912. }
  913. }
  914. return 1;
  915. }
  916. CMD:rbeacon(playerid, params[])
  917. {
  918. if(!IsACop(playerid)) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not a LEO.");
  919. if(GetGVarInt("RobberyStage") < 3) return 1;
  920. else
  921. {
  922. new iSafeID = GetGVarInt("RobbedSafeID"),
  923. iTypeID = SafeData[iSafeID][g_iTypeID];
  924. SetPVarInt(playerid, "_RobberyBeacon", 1);
  925. switch(SafeData[iSafeID][g_iType])
  926. {
  927. case 1:
  928. {
  929. SetPlayerCheckpoint(playerid, 1458.5452, -1012.2787, 27.3707, 4.0);
  930. if(GetGVarInt("RobberyEntrancePickupID"))
  931. SetGVarInt("RobberyEntrancePickupID", CreateDynamicPickup(1313, 1, 1458.5452, -1012.2787, 27.3707, 0));
  932. }
  933. case 2:
  934. {
  935. SetPlayerCheckpoint(playerid, arrGroupData[iTypeID][g_fGaragePos][0], arrGroupData[iTypeID][g_fGaragePos][1], arrGroupData[iTypeID][g_fGaragePos][2], 4.0);
  936. if(GetGVarInt("RobberyEntrancePickupID"))
  937. SetGVarInt("RobberyEntrancePickupID", CreateDynamicPickup(1313, 1, arrGroupData[iTypeID][g_fGaragePos][0], arrGroupData[iTypeID][g_fGaragePos][1], arrGroupData[iTypeID][g_fGaragePos][2], 0));
  938. }
  939. case 3:
  940. {
  941. SetPlayerCheckpoint(playerid, arrGroupData[iTypeID][g_fGaragePos][0], arrGroupData[iTypeID][g_fGaragePos][1], arrGroupData[iTypeID][g_fGaragePos][2], 4.0);
  942. if(GetGVarInt("RobberyEntrancePickupID"))
  943. SetGVarInt("RobberyEntrancePickupID", CreateDynamicPickup(1313, 1, arrGroupData[iTypeID][g_fGaragePos][0], arrGroupData[iTypeID][g_fGaragePos][1], arrGroupData[iTypeID][g_fGaragePos][2], 0));
  944. }
  945. case 4:
  946. {
  947. SetPlayerCheckpoint(playerid, Businesses[iTypeID][bExtPos][0], Businesses[iTypeID][bExtPos][1], Businesses[iTypeID][bExtPos][2], 4.0);
  948. if(GetGVarInt("RobberyEntrancePickupID"))
  949. SetGVarInt("RobberyEntrancePickupID", CreateDynamicPickup(1313, 1, Businesses[iTypeID][bExtPos][0], Businesses[iTypeID][bExtPos][1], Businesses[iTypeID][bExtPos][2], 0));
  950. }
  951. case 5:
  952. {
  953. SetPlayerCheckpoint(playerid, 0.0, 0.0, 0.0, 4.0);
  954. if(GetGVarInt("RobberyEntrancePickupID"))
  955. SetGVarInt("RobberyEntrancePickupID", CreateDynamicPickup(1313, 1, 0.0, 0.0, 0.0, 0));
  956. }
  957. }
  958. }
  959. return 1;
  960. }
  961. /*CMD:mask(playerid, params[])
  962. {
  963. if(GetPVarInt(playerid, "_WearingMask"))
  964. {
  965. DeletePVar(playerid, "_WearingMask");
  966. RemovePlayerAttachedObject(playerid, 9);
  967. foreach(new i: Player)
  968. {
  969. if(PlayerInfo[i][pAdmin] == 0)
  970. ShowPlayerNameTagForPlayer(i, playerid, true);
  971. }
  972. }
  973. else
  974. {
  975. SetPVarInt(playerid, "_WearingMask", 1);
  976. SetPlayerAttachedObject(playerid, 9, 19801, 2, 0.060999, 0.024000, -0.000999, 5.400002, 85.799995, 176.399963, 1.310001, 1.230000, 1.133000);
  977. foreach(new i: Player) ShowPlayerNameTagForPlayer(i, playerid, false);
  978. }
  979. return 1;
  980. }*/
  981. checkSafePerms(playerid)
  982. {
  983. new iSafeID = GetSafeID(playerid);
  984. switch(SafeData[iSafeID][g_iType])
  985. {
  986. case 1: if(PlayerInfo[playerid][pAdmin] < 1337) return 1;
  987. case 2: if(SafeData[iSafeID][g_iTypeID] == PlayerInfo[playerid][pLeader]) return 1;
  988. case 3: if(SafeData[iSafeID][g_iTypeID] == PlayerInfo[playerid][pBusiness] && PlayerInfo[playerid][pBusinessRank] == 5) return 1;
  989. }
  990. return 0;
  991. }
  992. CMD:safe(playerid, params[])
  993. {
  994. new iSafeID = GetSafeID(playerid);
  995. if(iSafeID == -1) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not near a safe");
  996. if(PlayerInfo[playerid][pAdmin] == 0)
  997. {
  998. switch(SafeData[iSafeID][g_iType])
  999. {
  1000. case 1: if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot access this safe.");
  1001. case 2: if(SafeData[iSafeID][g_iTypeID] != PlayerInfo[playerid][pMember]) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot access this safe.");
  1002. case 3: if(SafeData[iSafeID][g_iTypeID] != PlayerInfo[playerid][pBusiness]) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot access this safe.");
  1003. }
  1004. }
  1005. ShowPlayerDialogEx(playerid, DIALOG_SAFE_PIN, DIALOG_STYLE_INPUT, "Safe | Enter Pin", "Please enter the safe's pin to open it.", "X", "V");
  1006. return 1;
  1007. }
  1008. CMD:createsafe(playerid, params[])
  1009. {
  1010. if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessageEx(playerid, COLOR_GRAD1, "You do not have the authority to use this command");
  1011. safeCreate(playerid);
  1012. return 1;
  1013. }
  1014. CMD:editsafe(playerid, params[])
  1015. {
  1016. if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessageEx(playerid, COLOR_GRAD1, "You do not have the authority to use this command");
  1017. new iSafeID = GetSafeID(playerid);
  1018. if(iSafeID == -1) return SendClientMessageEx(playerid, COLOR_GRAD1, "You need to be near a safe to edit it.");
  1019. SetPVarInt(playerid, "_EditingSafeID", iSafeID);
  1020. safeEditMenu(playerid);
  1021. return 1;
  1022. }
  1023. CMD:deletesafe(playerid, params[]) {
  1024. if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessageEx(playerid, COLOR_GRAD1, "You do not have the authority to use this command");
  1025. safeDelete(playerid, params);
  1026. return 1;
  1027. }
  1028. CMD:dropbag(playerid, params[])
  1029. {
  1030. dropBag(playerid);
  1031. return 1;
  1032. }
  1033. dropBag(playerid)
  1034. {
  1035. if(GetPVarInt(playerid, "_HasBag"))
  1036. {
  1037. new iRobberID = GetPVarInt(playerid, "_RobberID"),
  1038. str[64];
  1039. MoneyBagData[iRobberID][g_iMoney] = GetPVarInt(playerid, "_CollectedMoney");
  1040. DeletePVar(playerid, "_CollectedMoney");
  1041. DeletePVar(playerid, "_HasBag");
  1042. GivePlayerCash(playerid, -MoneyBagData[iRobberID][g_iMoney]);
  1043. GetPlayerPos(playerid, MoneyBagData[iRobberID][g_fPos][0], MoneyBagData[iRobberID][g_fPos][1], MoneyBagData[iRobberID][g_fPos][2]);
  1044. RemovePlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 2);
  1045. RemovePlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 1);
  1046. MoneyBagData[iRobberID][g_iObjectID][0] = CreateDynamicObject(1550, MoneyBagData[iRobberID][g_fPos][0], MoneyBagData[iRobberID][g_fPos][1], MoneyBagData[iRobberID][g_fPos][2]-0.5, 0.0, 90.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
  1047. if(IsValidDynamic3DTextLabel(MoneyBagData[iRobberID][g_iTextLabel]))
  1048. DestroyDynamic3DTextLabel(MoneyBagData[iRobberID][g_iTextLabel]);
  1049. format(str, sizeof(str), "Money Bag: $%s (ID: %i)", number_format(MoneyBagData[iRobberID][g_iMoney]), iRobberID);
  1050. MoneyBagData[iRobberID][g_iTextLabel] = CreateDynamic3DTextLabel(str, COLOR_LIGHTBLUE, MoneyBagData[iRobberID][g_fPos][0], MoneyBagData[iRobberID][g_fPos][1], MoneyBagData[iRobberID][g_fPos][2], 10.0, INVALID_PLAYER_ID);
  1051. }
  1052. }
  1053. CMD:takebag(playerid, params[])
  1054. {
  1055. if(!GetPVarInt(playerid, "_HasBag"))
  1056. {
  1057. new iBagID = GetMoneyBagID(playerid);
  1058. if(iBagID == -1) return 1;
  1059. if(IsValidDynamic3DTextLabel(MoneyBagData[iBagID][g_iTextLabel]))
  1060. {
  1061. new str[64];
  1062. format(str, sizeof(str), "Money Bag: $%s (ID: %i)", number_format(MoneyBagData[iBagID][g_iMoney]), iBagID);
  1063. DestroyDynamic3DTextLabel(MoneyBagData[iBagID][g_iTextLabel]);
  1064. MoneyBagData[iBagID][g_iTextLabel] = CreateDynamic3DTextLabel(str, COLOR_LIGHTBLUE, 0.0, -0.3, 0.0, 10.0, playerid, INVALID_VEHICLE_ID, 1);
  1065. }
  1066. DestroyDynamicObject(MoneyBagData[iBagID][g_iObjectID][0]);
  1067. ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
  1068. RemovePlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 2);
  1069. RemovePlayerAttachedObject(playerid, MAX_PLAYER_ATTACHED_OBJECTS - 1);
  1070. MoneyBagData[iBagID][g_iObjectID][0] = SetPlayerAttachedObject(playerid,MAX_PLAYER_ATTACHED_OBJECTS - 2,1550,1,0.059999,-0.245000,0.057000,-4.199984,6.600003,99.299903,1.000000,1.000000,1.000000);
  1071. MoneyBagData[iBagID][g_iObjectID][1] = SetPlayerAttachedObject(playerid,MAX_PLAYER_ATTACHED_OBJECTS - 1,1550,1,0.017999,-0.235000,-0.136999,168.799987,-3.799941,35.799995,1.000000,1.000000,1.000000);
  1072. SetPVarInt(playerid, "_HasBag", 1);
  1073. SetPVarInt(playerid, "_CollectedMoney", MoneyBagData[iBagID][g_iMoney]);
  1074. }
  1075. return 1;
  1076. }
  1077. CMD:approverobbery(playerid, params[])
  1078. {
  1079. if(PlayerInfo[playerid][pAdmin] >= 1337) initiateRobbery(GetGVarInt("RobberyPlayerID"));
  1080. return 1;
  1081. }
  1082. CMD:denyrobbery(playerid, params[])
  1083. {
  1084. if(PlayerInfo[playerid][pAdmin] >= 1337) denyRobbery(GetGVarInt("RobberyPlayerID"));
  1085. else ProxDetector(10.0, GetGVarInt("RobberyPlayerID"), "[ADM NOTICE] Your robbery request has been denied.", COLOR_LIGHTRED,COLOR_LIGHTRED,COLOR_LIGHTRED,COLOR_LIGHTRED,COLOR_LIGHTRED);
  1086. return 1;
  1087. }
  1088. CMD:robbery(playerid, params[])
  1089. {
  1090. if(arrGroupData[PlayerInfo[playerid][pMember]][g_iGroupType] != GROUP_TYPE_CRIMINAL) return SendClientMessageEx(playerid, COLOR_GRAD1, "You have to be in a gang to use this command.");
  1091. new iSafeID = GetSafeID(playerid);
  1092. if(iSafeID == -1) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not near a safe.");
  1093. if(IsPlayerGangLeader(playerid) && ProxGangMemberCheck(playerid))
  1094. {
  1095. SetGVarInt("RobberyPlayerID", playerid);
  1096. SetGVarInt("RobbedSafeID", iSafeID);
  1097. SafeData[iSafeID][g_iInitialMoney] = SafeData[iSafeID][g_iMoney];
  1098. checkRobbery(playerid);
  1099. }
  1100. else
  1101. {
  1102. SendClientMessageEx(playerid, COLOR_GRAD1, "You are not a gang leader or you do not have enough participating gang members.");
  1103. }
  1104. return 1;
  1105. }
  1106. CMD:editrobbery(playerid, params[])
  1107. {
  1108. if(PlayerInfo[playerid][pAdmin] < 1337) return 1;
  1109. new szDialog[256];
  1110. format(szDialog, sizeof(szDialog), "Robable percentage\t\t%i\nCollect rate\t\t$%s / 10s\nMinimum robbers\t\t%i", ROB_MAX_PERCENTAGE, number_format(ROB_COLLECT_RATE), ROB_MIN_MEMBERS);
  1111. ShowPlayerDialogEx(playerid, DIALOG_ROBBERY_SETUP, DIALOG_STYLE_TABLIST, "Robbery Setup Menu", szDialog, "Cancel", "Select");
  1112. return 1;
  1113. }
  1114. CMD:endrobbery(playerid, params[])
  1115. {
  1116. if(PlayerInfo[playerid][pAdmin] < 1337) return 1;
  1117. stopRobbery();
  1118. return 1;
  1119. }
  1120. CMD:robsafe(playerid, params[])
  1121. {
  1122. if(!GetGVarInt("RobberyStage")) return SendClientMessageEx(playerid, COLOR_GRAD1, "You did not get an approval yet.");
  1123. if(GetSafeID(playerid) != GetGVarInt("RobbedSafeID")) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not near the safe.");
  1124. ShowPlayerDialogEx(playerid, DIALOG_ROBBERY_SAFE, DIALOG_STYLE_INPUT, "Safe PIN", "Please enter the PIN to open the safe.", "Cancel", "Enter");
  1125. return 1;
  1126. }