1
0

banking.pwn 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Banking System
  11. Next Generation Gaming, LLC
  12. (created by Next Generation Gaming Development Team)
  13. * Copyright (c) 2016, Next Generation Gaming, LLC
  14. *
  15. * All rights reserved.
  16. *
  17. * Redistribution and use in source and binary forms, with or without modification,
  18. * are not permitted in any case.
  19. *
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  25. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  26. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  27. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  28. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  29. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  30. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. */
  33. /*
  34. new iBankVault;
  35. task Bank_VaultCheck[60000 * 15]() {
  36. Bank_UpdateBank(iBankVault);
  37. }
  38. Bank_LoadBank() {
  39. // Current Main Server vault: 216.000.000.000. Above 32-bit int limit. Divide by 1000 from bigint column to get a readable number for SA:MP.
  40. mysql_tquery(MainPipeline, "SELECT money / 1000 FROM `bank` WHERE `id` = '1'", true, "Bank_OnLoadBank", "");
  41. }
  42. forward Bank_OnLoadBank();
  43. public Bank_OnLoadBank() {
  44. new iRows,
  45. iFields;
  46. cache_get_data(iRows, iFields, MainPipeline);
  47. iBankVault = cache_get_field_content_int(0, "money / 1000", MainPipeline);
  48. print("[LS Bank] - Loaded all the $$$");
  49. return 1;
  50. }
  51. */
  52. Bank_UpdateBank(iAmount) {
  53. mysql_format(MainPipeline, szMiscArray, sizeof(szMiscArray), "UPDATE `bank` SET `money` = money + %d WHERE `money` > 0", iAmount);
  54. mysql_tquery(MainPipeline, szMiscArray, "Bank_OnUpdateBank", "i", iAmount);
  55. }
  56. forward Bank_OnUpdateBank(iAmount);
  57. public Bank_OnUpdateBank(iAmount) {
  58. new iRows;
  59. cache_get_row_count(iRows);
  60. if(iRows) {
  61. format(szMiscArray, sizeof(szMiscArray), "[LS BANK] Processed $%s", iAmount);
  62. Log("logs/bank.log", szMiscArray);
  63. }
  64. else Bank_Bankrupt();
  65. return 1;
  66. }
  67. forward Bank_FetchData(playerid);
  68. public Bank_FetchData(playerid) {
  69. new iRows,
  70. szMoney[16];
  71. cache_get_row_count(iRows);
  72. if(iRows) {
  73. cache_get_value_name(0, "money", szMoney, sizeof(szMoney));
  74. format(szMiscArray, sizeof(szMiscArray), "[BANK]: Vault: {CCCCCC}$%s", szMoney);
  75. SendClientMessageEx(playerid, COLOR_YELLOW, szMiscArray);
  76. }
  77. return 1;
  78. }
  79. Bank_Bankrupt() {
  80. SetGVarInt("Bankrupt", 1);
  81. }
  82. Bank_TransferCheck(iAmount) {
  83. /*
  84. if((-2147483647 < iBankVault + iAmount < 2147483647)) {
  85. if(iBankVault > (iAmount * -1)) { // If you withdraw, the bank will always be happy.
  86. Bank_ProcessMoney(iAmount);
  87. }
  88. else Bank_UpdateBank(iAmount, 1);
  89. }
  90. else {
  91. Bank_UpdateBank(iAmount, 1);
  92. }
  93. if(GetGVarInt("Bankrupt")) return 0;
  94. */
  95. if(GetGVarInt("Bankrupt")) {
  96. // SendClientMessageEx(playerid, COLOR_LIGHTRED, "[Bank]: We're terribly sorry, we are bankrupt.");
  97. // return 0;
  98. return 1;
  99. }
  100. else Bank_UpdateBank(iAmount);
  101. return 1;
  102. }
  103. /*
  104. Bank_ProcessMoney(iAmount) {
  105. iBankVault += iAmount;
  106. }
  107. */
  108. CMD:bankvault(playerid, params[]) {
  109. if(!IsAdminLevel(playerid, ADMIN_SENIOR, 1)) return 1;
  110. mysql_tquery(MainPipeline, "SELECT `money` FROM `bank` WHERE `id` = '1'", "Bank_FetchData", "i", playerid);
  111. return 1;
  112. }
  113. CMD:resetbank(playerid, params[]) {
  114. if(!IsAdminLevel(playerid, ADMIN_SENIOR, 1)) return 1;
  115. mysql_tquery(MainPipeline, "UPDATE `bank` SET `money` = (SELECT SUM(`money`) FROM `accounts`) WHERE `id` = 1", "Bank_ResetVault", "i", playerid);
  116. return 1;
  117. }
  118. forward Bank_ResetVault(playerid);
  119. public Bank_ResetVault(playerid) {
  120. if(mysql_errno(MainPipeline)) SendClientMessageEx(playerid, COLOR_GRAD1, "Something went wrong.");
  121. mysql_tquery(MainPipeline, "SELECT `money` FROM `bank` WHERE `id` = '1'", "Bank_FetchData", "i", playerid);
  122. }
  123. /*
  124. CMD:updatevault(playerid, parmas[]) {
  125. if(!IsAdminLevel(playerid, ADMIN_HEAD, 1)) return 1;
  126. Bank_UpdateBank(iBankVault);
  127. SendClientMessageEx(playerid, COLOR_YELLOW, "[BANK]: You updated the bank vault, resetting the cash flow.");
  128. return 1;
  129. }
  130. */
  131. PayDay(i) {
  132. if(!gPlayerLogged{i}) return 1;
  133. new
  134. string[128],
  135. interest,
  136. pVIPTax,
  137. year,
  138. month,
  139. day;
  140. getdate(year, month, day);
  141. if(PlayerInfo[i][pLevel] > 0 && (PlayerInfo[i][pTogReports] == 1 || PlayerInfo[i][pAdmin] < 2)) {
  142. if(GetPVarType(i, "debtMsg")) {
  143. if(GetPlayerCash(i) < 0 && PlayerInfo[i][pJailTime] < 1 && !IsACop(i) && PlayerInfo[i][pWantedLevel] < 6) {
  144. format(string,sizeof(string),"You're in debt $%s - find a way to pay back the money or you might get in trouble!", number_format(GetPlayerCash(i)));
  145. SendClientMessageEx(i, COLOR_LIGHTRED, string);
  146. }
  147. else DeletePVar(i, "debtMsg");
  148. }
  149. if(0 <= PlayerInfo[i][pRenting] < sizeof HouseInfo) {
  150. if(HouseInfo[PlayerInfo[i][pRenting]][hRentFee] > PlayerInfo[i][pAccount]) {
  151. PlayerInfo[i][pRenting] = INVALID_HOUSE_ID;
  152. SendClientMessageEx(i, COLOR_WHITE, "You have been evicted from your residence for failing to pay rent fees.");
  153. }
  154. else {
  155. if(!Bank_TransferCheck(-HouseInfo[PlayerInfo[i][pRenting]][hRentFee])) return 1;
  156. HouseInfo[PlayerInfo[i][pRenting]][hSafeMoney] += HouseInfo[PlayerInfo[i][pRenting]][hRentFee];
  157. PlayerInfo[i][pAccount] -= HouseInfo[PlayerInfo[i][pRenting]][hRentFee];
  158. }
  159. }
  160. if(PlayerInfo[i][pConnectSeconds] >= 3600) {
  161. if(GetPVarInt(i, "pBirthday") == 1) {
  162. PlayerInfo[i][pPayCheck] = PlayerInfo[i][pPayCheck] * 2;
  163. }
  164. if(GetPVarType(i, "AdvisorDuty")) {
  165. PlayerInfo[i][pDutyHours]++;
  166. }
  167. if(SpecTimer) AddSpecialToken(i);
  168. SendClientMessageEx(i, COLOR_WHITE, "________ BANK STATEMENT ________");
  169. if(PlayerInfo[i][pNation] == 0)
  170. {
  171. if(PlayerInfo[i][pDonateRank] < 4)
  172. {
  173. format(string, sizeof(string), " Paycheck: $%s | SA Gov Tax: $%s (%d percent)", number_format(PlayerInfo[i][pPayCheck]), number_format((PlayerInfo[i][pPayCheck] / 100) * TaxValue), TaxValue);
  174. if(!Bank_TransferCheck((PlayerInfo[i][pPayCheck] / 100) * TaxValue)) return 1;
  175. PlayerInfo[i][pAccount] -= (PlayerInfo[i][pPayCheck] / 100) * TaxValue;
  176. Tax += (PlayerInfo[i][pPayCheck] / 100) * TaxValue;
  177. }
  178. else
  179. {
  180. pVIPTax = TaxValue - 15;
  181. if(pVIPTax < 0) { pVIPTax = 0; }
  182. format(string, sizeof(string), " Paycheck: $%s | SA Gov Tax: $%s (%d percent) {FFFF00}(Platinum VIP: 15 percent off)", number_format(PlayerInfo[i][pPayCheck]), number_format((PlayerInfo[i][pPayCheck] / 100) * pVIPTax), pVIPTax);
  183. if(!Bank_TransferCheck((PlayerInfo[i][pPayCheck] / 100) * pVIPTax)) return 1;
  184. PlayerInfo[i][pAccount] -= (PlayerInfo[i][pPayCheck] / 100) * pVIPTax;
  185. Tax += (PlayerInfo[i][pPayCheck] / 100) * pVIPTax;
  186. }
  187. }
  188. else if(PlayerInfo[i][pNation] == 1)
  189. {
  190. if(PlayerInfo[i][pDonateRank] < 4)
  191. {
  192. format(string, sizeof(string), " Paycheck: $%s | NE Gov Tax: $%s (%d percent)", number_format(PlayerInfo[i][pPayCheck]), number_format((PlayerInfo[i][pPayCheck] / 100) * TRTaxValue), TRTaxValue);
  193. if(!Bank_TransferCheck((PlayerInfo[i][pPayCheck] / 100) * TRTaxValue)) return 1;
  194. PlayerInfo[i][pAccount] -= (PlayerInfo[i][pPayCheck] / 100) * TRTaxValue;
  195. TRTax += (PlayerInfo[i][pPayCheck] / 100) * TRTaxValue;
  196. }
  197. else
  198. {
  199. pVIPTax = TRTaxValue - 15;
  200. if(pVIPTax < 0) { pVIPTax = 0; }
  201. format(string, sizeof(string), " Paycheck: $%s | NE Gov Tax: $%s (%d percent) {FFFF00}(Platinum VIP: 15 percent off)", number_format(PlayerInfo[i][pPayCheck]), number_format((PlayerInfo[i][pPayCheck] / 100) * pVIPTax), pVIPTax);
  202. if(!Bank_TransferCheck((PlayerInfo[i][pPayCheck] / 100) * pVIPTax)) return 1;
  203. PlayerInfo[i][pAccount] -= (PlayerInfo[i][pPayCheck] / 100) * pVIPTax;
  204. TRTax += (PlayerInfo[i][pPayCheck] / 100) * pVIPTax;
  205. }
  206. }
  207. SendClientMessageEx(i, COLOR_GRAD1, string);
  208. interest = (PlayerInfo[i][pAccount] + 1) / 1000;
  209. switch(PlayerInfo[i][pDonateRank]) {
  210. case 0: {
  211. if(interest > 50000) interest = 50000;
  212. format(string, sizeof(string), " Balance: $%s | Interest rate: 0.1 percent (50k max)", number_format(PlayerInfo[i][pAccount]));
  213. SendClientMessageEx(i, COLOR_GRAD1, string);
  214. }
  215. case 1: {
  216. if(interest > 100000) interest = 100000;
  217. format(string, sizeof(string), " Balance: $%s | Interest rate: 0.1 percent {FFFF00}(Bronze VIP: 100k max)", number_format(PlayerInfo[i][pAccount]));
  218. SendClientMessageEx(i, COLOR_GRAD1, string);
  219. }
  220. case 2: {
  221. if(interest > 150000) interest = 150000;
  222. format(string, sizeof(string), " Balance: $%s | Interest rate: 0.1 percent {FFFF00}(Silver VIP: 150k max)", number_format(PlayerInfo[i][pAccount]));
  223. SendClientMessageEx(i, COLOR_GRAD1, string);
  224. }
  225. case 3: {
  226. if(interest > 200000) interest = 200000;
  227. format(string, sizeof(string), " Balance: $%s | Interest rate: 0.1 percent {FFFF00}(Gold VIP: 200k max)", number_format(PlayerInfo[i][pAccount]));
  228. SendClientMessageEx(i, COLOR_GRAD1, string);
  229. }
  230. case 4, 5: {
  231. if(interest > 250000) interest = 250000;
  232. format(string, sizeof(string), " Balance: $%s | Interest rate: 0.1 percent {FFFF00}(Platinum VIP: 250k max)", number_format(PlayerInfo[i][pAccount]));
  233. SendClientMessageEx(i, COLOR_GRAD1, string);
  234. }
  235. }
  236. if(PlayerInfo[i][pTaxiLicense] == 1) {
  237. PlayerInfo[i][pAccount] -= (PlayerInfo[i][pPayCheck] / 100) * 5;
  238. Tax += (PlayerInfo[i][pPayCheck] / 100) * 5;
  239. format(string, sizeof(string), " Taxi licensing fee (5 percent): $%s", number_format((PlayerInfo[i][pPayCheck] / 100) * 5));
  240. SendClientMessageEx(i, COLOR_GRAD2, string);
  241. }
  242. for(new iGroupID; iGroupID < MAX_GROUPS; iGroupID++)
  243. {
  244. if(PlayerInfo[i][pNation] == 0)
  245. {
  246. if(arrGroupData[iGroupID][g_iAllegiance] == 1)
  247. {
  248. if(arrGroupData[iGroupID][g_iGroupType] == GROUP_TYPE_GOV)
  249. {
  250. new str[128];
  251. if(PlayerInfo[i][pDonateRank] < 4) {
  252. format(str, sizeof(str), "%s has paid $%s in tax.", GetPlayerNameEx(i), number_format((PlayerInfo[i][pPayCheck] / 100) * TaxValue));
  253. } else {
  254. format(str, sizeof(str), "%s has paid $%s in tax.", GetPlayerNameEx(i), number_format((PlayerInfo[i][pPayCheck] / 100) * pVIPTax));
  255. }
  256. GroupPayLog(iGroupID, str);
  257. }
  258. }
  259. }
  260. else if (PlayerInfo[i][pNation] == 1)
  261. {
  262. if(arrGroupData[iGroupID][g_iAllegiance] == 2)
  263. {
  264. if(arrGroupData[iGroupID][g_iGroupType] == GROUP_TYPE_GOV)
  265. {
  266. new str[128];
  267. if(PlayerInfo[i][pDonateRank] < 4) {
  268. format(str, sizeof(str), "%s has paid $%s in tax.", GetPlayerNameEx(i), number_format((PlayerInfo[i][pPayCheck] / 100) * TRTaxValue));
  269. } else {
  270. format(str, sizeof(str), "%s has paid $%s in tax.", GetPlayerNameEx(i), number_format((PlayerInfo[i][pPayCheck] / 100) * pVIPTax));
  271. }
  272. GroupPayLog(iGroupID, str);
  273. }
  274. }
  275. }
  276. }
  277. if(!Bank_TransferCheck(-interest)) return 1;
  278. PlayerInfo[i][pAccount] += interest;
  279. format(string, sizeof(string), " Interest gained: $%s", number_format(interest));
  280. SendClientMessageEx(i, COLOR_GRAD3, string);
  281. SendClientMessageEx(i, COLOR_GRAD4, "______________________________________");
  282. format(string, sizeof(string), " New balance: $%s | Rent paid: $%s", number_format(PlayerInfo[i][pAccount]), number_format((0 <= PlayerInfo[i][pRenting] < sizeof HouseInfo) ? (HouseInfo[PlayerInfo[i][pRenting]][hRentFee]) : (0)));
  283. SendClientMessageEx(i, COLOR_GRAD5, string);
  284. //GivePlayerCash(i, PlayerInfo[i][pPayCheck]);
  285. GivePlayerCashEx(i, TYPE_BANK, PlayerInfo[i][pPayCheck]);
  286. HourDedicatedPlayer(i);
  287. /*if(month == 12 && day == 5)
  288. {
  289. if(++PlayerInfo[i][pFallIntoFun] == 5)
  290. {
  291. if(PlayerInfo[i][pReceivedPrize] == 0)
  292. {
  293. PlayerInfo[i][pGVIPExVoucher] += 1;
  294. SendClientMessageEx(i, COLOR_LIGHTBLUE, "You have received a 7 day Gold VIP voucher for playing 5 hours.");
  295. PlayerInfo[i][pReceivedPrize] = 1;
  296. }
  297. PlayerInfo[i][pFallIntoFun] = 0;
  298. }
  299. }*/
  300. // Fall Into Fun - 100 HP every 5 paychecks
  301. /*PlayerInfo[i][pFallIntoFun]++;
  302. if(PlayerInfo[i][pFallIntoFun] == 5)
  303. {
  304. new Float: health;
  305. GetHealth(i, health);
  306. if(health == 100)
  307. {
  308. PlayerInfo[i][pFirstaid]++;
  309. SendClientMessageEx(i, COLOR_LIGHTBLUE, "You have played for 5 hours and received a firstaid kit due to having 100 percent health already.");
  310. PlayerInfo[i][pFallIntoFun] = 0;
  311. }
  312. else
  313. {
  314. SetHealth(i, 100.0);
  315. SendClientMessageEx(i, COLOR_LIGHTBLUE, "You have played for 5 hours and received 100 percent HP.");
  316. PlayerInfo[i][pFallIntoFun] = 0;
  317. }
  318. }*/
  319. PayGroupMember(i);
  320. if (PlayerInfo[i][pBusiness] != INVALID_BUSINESS_ID) {
  321. if (Businesses[PlayerInfo[i][pBusiness]][bAutoPay] && PlayerInfo[i][pBusinessRank] >= 0 && PlayerInfo[i][pBusinessRank] < 5) {
  322. if (Businesses[PlayerInfo[i][pBusiness]][bSafeBalance] < Businesses[PlayerInfo[i][pBusiness]][bRankPay][PlayerInfo[i][pBusinessRank]]) {
  323. SendClientMessageEx(i,COLOR_RED,"Business doesn't have enough cash for your pay.");
  324. }
  325. else {
  326. //GivePlayerCash(i, Businesses[PlayerInfo[i][pBusiness]][bRankPay][PlayerInfo[i][pBusinessRank]]);
  327. GivePlayerCashEx(i, TYPE_BANK, Businesses[PlayerInfo[i][pBusiness]][bRankPay][PlayerInfo[i][pBusinessRank]]);
  328. Businesses[PlayerInfo[i][pBusiness]][bSafeBalance] -= Businesses[PlayerInfo[i][pBusiness]][bRankPay][PlayerInfo[i][pBusinessRank]];
  329. SaveBusiness(PlayerInfo[i][pBusiness]);
  330. format(string,sizeof(string)," Business pay: $%s", number_format(Businesses[PlayerInfo[i][pBusiness]][bRankPay][PlayerInfo[i][pBusinessRank]]));
  331. SendClientMessageEx(i, COLOR_GRAD2, string);
  332. }
  333. }
  334. }
  335. GameTextForPlayer(i, "~y~PayDay~n~~w~Paycheck", 5000, 1);
  336. //SendAudioToPlayer(i, 63, 100);
  337. PlayerInfo[i][pConnectSeconds] = 0;
  338. PlayerInfo[i][pPayCheck] = 0;
  339. if(++PlayerInfo[i][pConnectHours] == 2) {
  340. SendClientMessageEx(i, COLOR_LIGHTRED, "You may now possess/use weapons!");
  341. }
  342. if(PlayerInfo[i][pDonateRank] > 0 && ++PlayerInfo[i][pPayDayHad] >= 5) {
  343. PlayerInfo[i][pExp]++;
  344. PlayerInfo[i][pPayDayHad] = 0;
  345. }
  346. // Auto Levels
  347. if(PlayerInfo[i][pAdmin] < 2) LevelCheck(i);
  348. // Zombie Halloween
  349. if(month == 10 && day == 30)
  350. {
  351. if(PlayerInfo[i][pFallIntoFun] < 4)
  352. {
  353. PlayerInfo[i][pFallIntoFun]++;
  354. }
  355. else {
  356. PlayerInfo[i][pFallIntoFun] = 0;
  357. PlayerInfo[i][pVials] += 1;
  358. }
  359. }
  360. /*
  361. if((month == 12 && day == 24) || (month == 10 && day == 31))
  362. {
  363. if(PlayerInfo[i][pTrickortreat] > 0)
  364. {
  365. PlayerInfo[i][pTrickortreat]--;
  366. }
  367. }*/
  368. if(month == 10 && (day == 29 || day == 30 || day == 31))
  369. {
  370. ++PlayerInfo[i][pTrickortreat];
  371. if(PlayerInfo[i][pTrickortreat] == 15) {
  372. GiveHtoy(i, 2590, "Scythe");
  373. }
  374. if(PlayerInfo[i][pTrickortreat] == 30) {
  375. GiveHtoy(i, 2907, "Zombie Torso");
  376. }
  377. }
  378. if(month == 5 && day == 25) //Memorial Day 2015
  379. {
  380. if(++PlayerInfo[i][pTrickortreat] == 3)
  381. SendClientMessageEx(i, -1, "You have been given 1 Double EXP Token for playing 3 hours!"), PlayerInfo[i][pEXPToken]++, PlayerInfo[i][pTrickortreat] = 0;
  382. }
  383. //Weekday Madness for Fall Into Fun event; re-using Trickortreat variable to check connected time
  384. /*if(month == 10 && (day == 9 || day == 16))
  385. {
  386. PlayerInfo[i][pRewardDrawChance] += 2;
  387. }
  388. else if(month == 10 && day == 19)
  389. {
  390. PlayerInfo[i][pRewardDrawChance] += 3;
  391. }
  392. else PlayerInfo[i][pRewardDrawChance]++;
  393. if(PlayerInfo[i][pDonateRank] >= 3 && month == 10 && day == 13)
  394. {
  395. PlayerInfo[i][pRewardDrawChance] += 3;
  396. }*/
  397. Misc_Save();
  398. if(iRewardPlay) {
  399. PlayerInfo[i][pRewardHours]++;
  400. if(floatround(PlayerInfo[i][pRewardHours]) % 16 == 0) {
  401. PlayerInfo[i][pGoldBoxTokens]++;
  402. SendClientMessage(i, COLOR_LIGHTBLUE, "You have received 1 Gold Giftbox token! #FallIntoFun");
  403. }
  404. format(string, sizeof(string), "You currently have %d Reward Hours, please check /rewards for more information.", floatround(PlayerInfo[i][pRewardHours]));
  405. SendClientMessageEx(i, COLOR_YELLOW, string);
  406. }
  407. if(PlayerInfo[i][pDoubleEXP] > 0) {
  408. PlayerInfo[i][pDoubleEXP]--;
  409. format(string, sizeof(string), "You have gained 2 respect points instead of 1. You have %d hours left on the Double EXP token.", PlayerInfo[i][pDoubleEXP]);
  410. SendClientMessageEx(i, COLOR_YELLOW, string);
  411. PlayerInfo[i][pExp] += 2;
  412. }
  413. else PlayerInfo[i][pExp]++;
  414. if(GetPVarInt(i, "pBirthday") == 1) {
  415. SendClientMessageEx(i, COLOR_YELLOW, "Gold VIP: You have received x2 paycheck as a birthday gift!");
  416. }
  417. if(PlayerInfo[i][pWRestricted] > 0 && --PlayerInfo[i][pWRestricted] == 0) {
  418. SendClientMessageEx(i, COLOR_LIGHTRED, "Your weapons are no longer restricted!");
  419. }
  420. if(PlayerInfo[i][pShopNotice] > 0) PlayerInfo[i][pShopNotice]--;
  421. if(ShopReminder == 1 && PlayerInfo[i][pShopNotice] == 0)
  422. {
  423. PlayerInfo[i][pShopCounter]++;
  424. PlayerInfo[i][mShopCounter]++;
  425. /*if(PlayerInfo[i][pLevel] <= 5 && PlayerInfo[i][mShopCounter] == 3 || (PlayerInfo[i][pLevel] > 5 && PlayerInfo[i][mShopCounter] >= 4 && PlayerInfo[i][pCredits] >= 10))
  426. {
  427. PlayerTextDrawSetString(i, MicroNotice[i], ShopMsg[PlayerInfo[i][mNotice]]);
  428. PlayerTextDrawShow(i, MicroNotice[i]);
  429. SetTimerEx("HidePlayerTextDraw", 10000, false, "ii", i, _:MicroNotice[i]);
  430. if(++PlayerInfo[i][mNotice] > 3) PlayerInfo[i][mNotice] = 0;
  431. PlayerInfo[i][mShopCounter] = 0;
  432. }
  433. if(PlayerInfo[i][pLevel] <= 5 && PlayerInfo[i][pShopCounter] == 5 || PlayerInfo[i][pLevel] > 5 && PlayerInfo[i][pShopCounter] == 10)
  434. {
  435. format(string, sizeof(string), "Hey check this out, type: ~y~/nggshop");
  436. if(PlayerInfo[i][pConnectHours] >= 50)
  437. {
  438. strcat(string, "~w~~n~To disable this notice for 24 hours, type: ~y~/togshopnotice");
  439. }
  440. PlayerInfo[i][pShopCounter] = 0;
  441. PlayerTextDrawSetString(i, ShopNotice[i], string);
  442. PlayerTextDrawShow(i, ShopNotice[i]);
  443. SetTimerEx("HidePlayerTextDraw", 10000, false, "ii", i, _:ShopNotice[i]);
  444. }*/
  445. }
  446. if(FIFEnabled == 1)
  447. {
  448. FIFInfo[i][FIFHours] += 1;
  449. if((FIFInfo[i][FIFHours] % 3) == 0)
  450. {
  451. if(FIFGThurs == 1)
  452. {
  453. GThursChances += 1;
  454. if(GThursChances == 23)
  455. {
  456. PlayerInfo[i][pGVIPVoucher] += 1;
  457. SendClientMessageEx(i, COLOR_WHITE, "You have won a 1 Month Gold VIP Voucher for Fall Into Fun! To claim it, type /myvouchers.");
  458. GThursChances = 0;
  459. format(string, sizeof(string), "%s(%d) won a 1 Month GVIP Voucher", GetPlayerNameEx(i), GetPlayerSQLId(i));
  460. Log("logs/fif.log", string);
  461. }
  462. }
  463. if(FIFGP3 == 1 && PlayerInfo[i][pDonateRank] >= 3)
  464. {
  465. FIFInfo[i][FIFChances] += 3;
  466. format(string,sizeof(string), "You have earned 3 FIF Chances! You now have %d chances!", FIFInfo[i][FIFChances]);
  467. SendClientMessageEx(i, COLOR_WHITE, string);
  468. format(string, sizeof(string), "%s(%d) won 3 FIF Chances", GetPlayerNameEx(i), GetPlayerSQLId(i));
  469. Log("logs/fif.log", string);
  470. }
  471. else
  472. {
  473. switch(FIFType)
  474. {
  475. case 1:
  476. {
  477. FIFInfo[i][FIFChances] += 1;
  478. format(string,sizeof(string), "You have earned 1 FIF Chance! You now have %d chances!", FIFInfo[i][FIFChances]);
  479. SendClientMessageEx(i, COLOR_WHITE, string);
  480. format(string, sizeof(string), "%s(%d) won 1 FIF Chance.", GetPlayerNameEx(i), GetPlayerSQLId(i));
  481. Log("logs/fif.log", string);
  482. }
  483. case 2:
  484. {
  485. FIFInfo[i][FIFChances] += 2;
  486. format(string,sizeof(string), "You have earned 2 FIF Chance's! You now have %d chances!", FIFInfo[i][FIFChances]);
  487. SendClientMessageEx(i, COLOR_WHITE, string);
  488. format(string, sizeof(string), "%s(%d) won 2 FIF Chances.", GetPlayerNameEx(i), GetPlayerSQLId(i));
  489. Log("logs/fif.log", string);
  490. }
  491. case 3:
  492. {
  493. FIFInfo[i][FIFChances] += 3;
  494. format(string,sizeof(string), "You have earned 3 FIF Chance's! You now have %d chances!", FIFInfo[i][FIFChances]);
  495. SendClientMessageEx(i, COLOR_WHITE, string);
  496. format(string, sizeof(string), "%s(%d) won 3 FIF Chances.", GetPlayerNameEx(i), GetPlayerSQLId(i));
  497. Log("logs/fif.log", string);
  498. }
  499. }
  500. }
  501. }
  502. if(FIFTimeWarrior == 1)
  503. {
  504. if(FIFInfo[i][FIFHours] % 28 == 0)
  505. {
  506. PlayerInfo[i][pGoldBoxTokens] += 1;
  507. SendClientMessageEx(i, COLOR_WHITE, "You have won a Gold Box Token for Fall Into Fun! To claim it, type /getrewardgift.");
  508. format(string, sizeof(string), "%s(%d) won a Gold Box Token", GetPlayerNameEx(i), GetPlayerSQLId(i));
  509. Log("logs/fif.log", string);
  510. }
  511. }
  512. g_mysql_SaveFIF(i);
  513. }
  514. if(month == 4 && (day == 25 || day == 26)) // NGG B-Day 2015
  515. {
  516. SendClientMessageEx(i, -1, "You have earned 3 event tokens for playing 1 hour! Use /inv to view your total token amount.");
  517. PlayerInfo[i][pEventTokens] += 3;
  518. }
  519. CallLocalFunction("InactivityCounter", "i", i);
  520. }
  521. else SendClientMessageEx(i, COLOR_LIGHTRED, "* You haven't played long enough to obtain a paycheck.");
  522. }
  523. if (GetPVarType(i, "UnreadMails") && HasMailbox(i))
  524. {
  525. SendClientMessageEx(i, COLOR_YELLOW, "You have unread items in your mailbox");
  526. }
  527. return 1;
  528. }
  529. forward GiveHtoy(giveplayerid, toyid, name[]);
  530. public GiveHtoy(giveplayerid, toyid, name[]) {
  531. new icount = GetPlayerToySlots(giveplayerid), success = 0, string[128];
  532. for(new v = 0; v < icount; v++)
  533. {
  534. if(PlayerToyInfo[giveplayerid][v][ptModelID] == 0)
  535. {
  536. PlayerToyInfo[giveplayerid][v][ptModelID] = toyid;
  537. PlayerToyInfo[giveplayerid][v][ptBone] = 6;
  538. PlayerToyInfo[giveplayerid][v][ptPosX] = 0.0;
  539. PlayerToyInfo[giveplayerid][v][ptPosY] = 0.0;
  540. PlayerToyInfo[giveplayerid][v][ptPosZ] = 0.0;
  541. PlayerToyInfo[giveplayerid][v][ptRotX] = 0.0;
  542. PlayerToyInfo[giveplayerid][v][ptRotY] = 0.0;
  543. PlayerToyInfo[giveplayerid][v][ptRotZ] = 0.0;
  544. PlayerToyInfo[giveplayerid][v][ptScaleX] = 1.0;
  545. PlayerToyInfo[giveplayerid][v][ptScaleY] = 1.0;
  546. PlayerToyInfo[giveplayerid][v][ptScaleZ] = 1.0;
  547. PlayerToyInfo[giveplayerid][v][ptTradable] = 1;
  548. g_mysql_NewToy(giveplayerid, v);
  549. success = 1;
  550. break;
  551. }
  552. }
  553. if(success == 0)
  554. {
  555. for(new i = 0; i < MAX_PLAYERTOYS; i++)
  556. {
  557. if(PlayerToyInfo[giveplayerid][i][ptModelID] == 0)
  558. {
  559. PlayerToyInfo[giveplayerid][i][ptModelID] = toyid;
  560. PlayerToyInfo[giveplayerid][i][ptBone] = 6;
  561. PlayerToyInfo[giveplayerid][i][ptPosX] = 0.0;
  562. PlayerToyInfo[giveplayerid][i][ptPosY] = 0.0;
  563. PlayerToyInfo[giveplayerid][i][ptPosZ] = 0.0;
  564. PlayerToyInfo[giveplayerid][i][ptRotX] = 0.0;
  565. PlayerToyInfo[giveplayerid][i][ptRotY] = 0.0;
  566. PlayerToyInfo[giveplayerid][i][ptRotZ] = 0.0;
  567. PlayerToyInfo[giveplayerid][i][ptScaleX] = 1.0;
  568. PlayerToyInfo[giveplayerid][i][ptScaleY] = 1.0;
  569. PlayerToyInfo[giveplayerid][i][ptScaleZ] = 1.0;
  570. PlayerToyInfo[giveplayerid][i][ptTradable] = 1;
  571. PlayerToyInfo[giveplayerid][i][ptSpecial] = 1;
  572. g_mysql_NewToy(giveplayerid, i);
  573. SendClientMessageEx(giveplayerid, COLOR_GRAD1, "Due to you not having any available slots, we've temporarily gave you an additional slot to use/sell/trade your %s.", name);
  574. SendClientMessageEx(giveplayerid, COLOR_RED, "Note: Please take note that after selling the %s, the temporarily additional toy slot will be removed.", name);
  575. break;
  576. }
  577. }
  578. }
  579. SendClientMessageEx(giveplayerid, COLOR_GRAD2, "For playing %d hours you have recived a %s!", PlayerInfo[giveplayerid][pTrickortreat], name);
  580. format(string, sizeof(string), "* %s was just gifted a %s!", GetPlayerNameEx(giveplayerid), name);
  581. ProxDetector(30.0, giveplayerid, string, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW, COLOR_YELLOW);
  582. format(string, sizeof(string), "* %s(%d) was just gifted a %s for playing %d hours during the zombie event.", GetPlayerNameEx(giveplayerid), GetPlayerSQLId(giveplayerid), name, PlayerInfo[giveplayerid][pTrickortreat]);
  583. Log("logs/giftbox.log", string), OnPlayerStatsUpdate(giveplayerid);
  584. return 1;
  585. }
  586. stock IsAtATM(playerid)
  587. {
  588. if(IsPlayerConnected(playerid))
  589. {
  590. if(IsPlayerInRangeOfPoint(playerid,3.0,2065.439453125, -1897.5510253906, 13.19670009613) || IsPlayerInRangeOfPoint(playerid,3.0,1497.7467041016, -1749.8747558594, 15.088212013245) || IsPlayerInRangeOfPoint(playerid,3.0,2093.5124511719, -1359.5474853516, 23.62727355957) || IsPlayerInRangeOfPoint(playerid,3.0,1155.6235351563, -1464.9141845703, 15.44321346283))
  591. {//ATMS
  592. return 1;
  593. }
  594. else if(IsPlayerInRangeOfPoint(playerid,3.0,2139.4487304688, -1164.0811767578, 23.63508605957) || IsPlayerInRangeOfPoint(playerid,3.0,1482.7761230469, -1010.3353881836, 26.48664855957) || IsPlayerInRangeOfPoint(playerid,3.0,1482.7761230469, -1010.3353881836, 26.48664855957) || IsPlayerInRangeOfPoint(playerid,3.0,387.16552734375, -1816.0512695313, 7.4834146499634))
  595. {//ATMS
  596. return 1;
  597. }
  598. else if(IsPlayerInRangeOfPoint(playerid,3.0,-24.385023117065, -92.001075744629, 1003.1897583008) || IsPlayerInRangeOfPoint(playerid,3.0,-31.811220169067, -58.106018066406, 1003.1897583008) || IsPlayerInRangeOfPoint(playerid,3.0,1212.7785644531, 2.451762676239, 1000.5647583008) || IsPlayerInRangeOfPoint(playerid,3.0,2324.4028320313, -1644.9445800781, 14.469946861267))
  599. {//ATMS
  600. return 1;
  601. }
  602. else if(IsPlayerInRangeOfPoint(playerid,3.0,2228.39, -1707.78, 13.25) || IsPlayerInRangeOfPoint(playerid,3.0,651.19305419922, -520.48815917969, 15.978837013245) || IsPlayerInRangeOfPoint(playerid, 3.0, 45.78035736084, -291.80926513672, 1.5024013519287) || IsPlayerInRangeOfPoint(playerid,3.0,1275.7958984375, 368.31481933594, 19.19758605957) || IsPlayerInRangeOfPoint(playerid,3.0,2303.4577636719, -13.539554595947, 26.12727355957))/*End of Red County Random ATM's*/
  603. {//ATMS
  604. return 1;
  605. }
  606. else if(IsPlayerInRangeOfPoint(playerid,3.0,294.80, -84.01, 1001.0) || /*Start of Red County Random ATM's*/IsPlayerInRangeOfPoint(playerid,3.0,691.08215332031, -618.5625, 15.978837013245) || IsPlayerInRangeOfPoint(playerid,3.0,173.23471069336, -155.07606506348, 1.2210245132446) || IsPlayerInRangeOfPoint(playerid,3.0,1260.8796386719, 209.30152893066, 19.19758605957) || IsPlayerInRangeOfPoint(playerid,3.0,2316.1015625, -88.522567749023, 26.12727355957))/*End of Red County Random ATM's*/
  607. {//ATMS
  608. return 1;
  609. }
  610. else if(IsPlayerInRangeOfPoint(playerid,3.0,1311.0361,-1446.2249,0.2216))
  611. {//ATMS
  612. return 1;
  613. }
  614. else if(IsPlayerInRangeOfPoint(playerid,3.0,2052.9246, -1660.6346, 13.1300) || IsPlayerInRangeOfPoint(playerid,3.0,-1980.6300,121.5300,27.3100))
  615. {
  616. return 1;
  617. }
  618. else if(IsPlayerInRangeOfPoint(playerid,3.0,-2453.7600,754.8200,34.8000) || IsPlayerInRangeOfPoint(playerid,3.0,-2678.6201,-283.3400,6.8000))
  619. {
  620. return 1;
  621. }
  622. else if(IsPlayerInRangeOfPoint(playerid,5.0,519.8157,-2890.8601,4.4609))
  623. {
  624. return 1;
  625. }
  626. else if(IsPlayerInRangeOfPoint(playerid,5.0,2565.667480, 1406.839355, 7699.584472) || IsPlayerInRangeOfPoint(playerid, 5.0, 3265.30004883, -631.90002441, 8423.90039062) || IsPlayerInRangeOfPoint(playerid, 5.0, 1829.5000, 1391.0000, 1464.0000) || IsPlayerInRangeOfPoint(playerid, 5.0, 1755.8000, 1434.1000, 2013.4000))
  627. {// VIP Lounge ATM || Package Club Interior
  628. return 1;
  629. }
  630. else if(IsPlayerInRangeOfPoint(playerid,5.0,-665.975341, -4033.334716, 20.779014) || IsPlayerInRangeOfPoint(playerid,5.0,-1619.9645996094,713.67535400391, 19995.501953125))
  631. {// Random Island ATM
  632. return 1;
  633. }
  634. // Famed Lounge
  635. else if(IsPlayerInRangeOfPoint(playerid, 3.0, 883.7170, 1442.4282, -82.3370))
  636. {
  637. return 1;
  638. }
  639. else if(IsPlayerInRangeOfPoint(playerid, 3.0, 2926.9199, -1529.9800, 10.6900)) return 1; //NGG Shop
  640. else if(IsPlayerInRangeOfPoint(playerid, 3.0, 986.4434,2056.2480,1085.8531) || IsPlayerInRangeOfPoint(playerid, 3.0, 1014.1396,2060.8284,1085.8531) || IsPlayerInRangeOfPoint(playerid, 3.0, 1013.4720,2023.8784,1085.8531)) return 1; //Glen Park
  641. else if(IsPlayerInRangeOfPoint(playerid, 3.0, 1378.0894, 1740.0106, 927.3564)) return 1; //Olympics
  642. }
  643. return 0;
  644. }
  645. CMD:pay(playerid, params[])
  646. {
  647. if(restarting) return SendClientMessageEx(playerid, COLOR_GRAD2, "Transactions are currently disabled due to the server being restarted for maintenance.");
  648. new id, storageid, amount;
  649. if(sscanf(params, "ud", id, amount)) {
  650. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /pay [player] [amount]");
  651. }
  652. /*if(sscanf(params, "udd", id, storageid, amount)) {
  653. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /pay [player] [storageid] [amount]");
  654. SendClientMessageEx(playerid, COLOR_GREY, "StorageIDs: (0) Pocket - (1) Equipped Storage Device");
  655. return 1;
  656. }
  657. if(storageid < 0 || storageid > 1) {
  658. SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /pay [player] [storageid] [amount]");
  659. SendClientMessageEx(playerid, COLOR_GREY, "StorageIDs: (0) Pocket - (1) Equipped Storage Device");
  660. return 1;
  661. }
  662. // Find the storageid of the storagedevice.
  663. if(storageid == 1) {
  664. new bool:itemEquipped = false;
  665. for(new i = 0; i < 3; i++)
  666. {
  667. if(StorageInfo[playerid][i][sAttached] == 1) {
  668. storageid = i+1;
  669. itemEquipped = true;
  670. }
  671. }
  672. if(itemEquipped == false) return SendClientMessageEx(playerid, COLOR_WHITE, "You don't have a storage device equipped!");
  673. }*/
  674. else if(!IsPlayerConnected(id)) {
  675. SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
  676. }
  677. else if(id == playerid) {
  678. SendClientMessageEx(playerid, COLOR_GREY, "You can not use this command on yourself!");
  679. }
  680. else if(!(1 <= amount <= 99999999)) {
  681. SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot pay below $1, or above $99,999,999 at once.");
  682. }
  683. else if(gettime()-GetPVarInt(playerid, "LastTransaction") < 10) {
  684. SendClientMessageEx(playerid, COLOR_GRAD2, "You can only make a transaction once every 10 seconds, please wait!");
  685. }
  686. else if(PlayerInfo[playerid][pCash] < 0 || PlayerInfo[playerid][pAccount] < 0) {
  687. SendClientMessageEx(playerid, COLOR_GRAD1, "Your cash on-hand or in the bank is currently at a negative value!");
  688. }
  689. else if(2 <= PlayerInfo[playerid][pAdmin] <= 4 || 2 <= PlayerInfo[id][pAdmin] <= 4) return 1;
  690. else if(ProxDetectorS(5.0, playerid, id)) {
  691. TransferStorage(id, -1, playerid, storageid, 1, amount, -1, -1);
  692. OnPlayerStatsUpdate(playerid);
  693. OnPlayerStatsUpdate(id);
  694. SetPVarInt(playerid, "LastTransaction", gettime());
  695. }
  696. else SendClientMessageEx(playerid, COLOR_GREY, "That person isn't near you.");
  697. return 1;
  698. }
  699. CMD:writecheck(playerid, params[])
  700. {
  701. new string[128], giveplayerid, monies, reason[64];
  702. if(sscanf(params, "uds[64]", giveplayerid, monies, reason)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /writecheck [Playerid/PartOfName] [Amount] [Reason]");
  703. if(!IsPlayerConnected(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
  704. if(monies < 1 || monies > 99999999)
  705. {
  706. SendClientMessageEx(playerid, COLOR_GRAD1, " You can't write a check for under $1 or over $99,999,999!");
  707. return 1;
  708. }
  709. if(PlayerInfo[playerid][pCash] < 0 || PlayerInfo[playerid][pAccount] < 0)
  710. {
  711. SendClientMessageEx(playerid, COLOR_GRAD1, "Your cash on-hand or in the bank is currently at a negative value!");
  712. }
  713. if(PlayerInfo[playerid][pChecks] == 0)
  714. {
  715. SendClientMessageEx(playerid, COLOR_GRAD1, " You must have a checkbook to write a check!");
  716. return 1;
  717. }
  718. if(gettime()-GetPVarInt(playerid, "LastTransaction") < 10) return SendClientMessageEx(playerid, COLOR_GRAD2, "You can only make a transaction once every 10 seconds, please wait!");
  719. if(strlen(reason) > 64) return SendClientMessageEx(playerid, COLOR_GRAD1, "Check details may not be longer than 64 characters in length.");
  720. if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You can't write a check to yourself!"); return 1; }
  721. if(ProxDetectorS(5.0, playerid, giveplayerid))
  722. {
  723. new playermoney = PlayerInfo[playerid][pAccount];
  724. if(monies > 0 && playermoney >= monies)
  725. {
  726. //GivePlayerCashEx(playerid, TYPE_BANK, -monies);
  727. //GivePlayerCashEx(giveplayerid, TYPE_BANK, monies);
  728. if(!Bank_TransferCheck(-monies)) return 1;
  729. PlayerInfo[playerid][pAccount] = PlayerInfo[playerid][pAccount] - monies;
  730. PlayerInfo[giveplayerid][pCheckCash] = PlayerInfo[giveplayerid][pCheckCash]+monies;
  731. if(PlayerInfo[playerid][pDonateRank] == 0)
  732. {
  733. new fee = (monies*8)/100;
  734. GivePlayerCash(playerid, (0 - fee));
  735. format(string, sizeof(string), " You have written a check for $%d to %s (for %s) and have been charged an 8 percent fee.",monies,GetPlayerNameEx(giveplayerid),reason);
  736. SendClientMessageEx(playerid, COLOR_GRAD1, string);
  737. PlayerInfo[playerid][pChecks]--;
  738. format(string, sizeof(string), " You now have %d checks left.",PlayerInfo[playerid][pChecks]);
  739. SendClientMessageEx(playerid, COLOR_GRAD1, string);
  740. }
  741. else
  742. {
  743. format(string, sizeof(string), " You have written a check for $%d to %s (for %s) and have not been charged the 8 percent fee.",monies,GetPlayerNameEx(giveplayerid),reason);
  744. SendClientMessageEx(playerid, COLOR_GRAD1, string);
  745. PlayerInfo[playerid][pChecks]--;
  746. format(string, sizeof(string), " You now have %d checks left.",PlayerInfo[playerid][pChecks]);
  747. SendClientMessageEx(playerid, COLOR_GRAD1, string);
  748. }
  749. format(string, sizeof(string), " You have recieved a check for $%d from %s for: %s", monies,GetPlayerNameEx(playerid),reason);
  750. SendClientMessageEx(giveplayerid, COLOR_GRAD1, string);
  751. format(string, sizeof(string), "* %s takes out a checkbook, fills out a check and hands it to %s.",GetPlayerNameEx(playerid),GetPlayerNameEx(giveplayerid));
  752. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  753. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  754. PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
  755. SetPVarInt(playerid, "LastTransaction", gettime());
  756. /*OnPlayerStatsUpdate(playerid);
  757. OnPlayerStatsUpdate(giveplayerid);*/
  758. new ip[32], ipex[32];
  759. GetPlayerIp(playerid, ip, sizeof(ip));
  760. GetPlayerIp(giveplayerid, ipex, sizeof(ipex));
  761. format(string, sizeof(string), "[CHECK] %s(%d) (IP:%s) has paid $%s to %s(%d) (IP:%s)", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), ip, number_format(monies), GetPlayerNameEx(giveplayerid), GetPlayerSQLId(giveplayerid), ipex);
  762. Log("logs/pay.log", string);
  763. }
  764. else
  765. {
  766. SendClientMessageEx(playerid, COLOR_GRAD1, " Invalid transaction amount, or you do not have enough money to give that much!");
  767. }
  768. }
  769. else
  770. {
  771. SendClientMessageEx(playerid, COLOR_GREY, "That person isn't near you.");
  772. }
  773. return 1;
  774. }
  775. CMD:charity(playerid, params[])
  776. {
  777. new moneys;
  778. if(sscanf(params, "d", moneys)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /charity [amount]");
  779. if(moneys < 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "That is not enough.");
  780. if(GetPlayerCash(playerid) < moneys) return SendClientMessageEx(playerid, COLOR_GRAD1, "You don't have that much money.");
  781. GivePlayerCash(playerid, -moneys);
  782. format(szMiscArray, sizeof(szMiscArray), "%s, thank you for your donation of $%s.", GetPlayerNameEx(playerid), number_format(moneys));
  783. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  784. SendClientMessageEx(playerid, COLOR_GRAD1, szMiscArray);
  785. format(szMiscArray, sizeof(szMiscArray), "[CHARITY] %s has donated $%s", GetPlayerNameEx(playerid), number_format(moneys));
  786. Log("logs/pay.log", szMiscArray);
  787. return 1;
  788. }
  789. CMD:nextpaycheck(playerid, params[])
  790. {
  791. new string[128];
  792. format(string, sizeof(string), "Total Minutes since last Paycheck: %d Approximate time until next Paycheck: %d", floatround(PlayerInfo[playerid][pConnectSeconds]/60), floatround((3600-PlayerInfo[playerid][pConnectSeconds]) / 60));
  793. SendClientMessageEx(playerid, COLOR_YELLOW, string);
  794. SendClientMessageEx(playerid, COLOR_GRAD2, "Please note that you will not accrue time if your game is paused.");
  795. return 1;
  796. }