vouchers.pwn 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Vouchers System
  11. Next Generation Gaming, LLC
  12. (created by Next Generation Gaming Development Team)
  13. * Copyright (c) 2016, Next Generation Gaming, LLC
  14. *
  15. * All rights reserved.
  16. *
  17. * Redistribution and use in source and binary forms, with or without modification,
  18. * are not permitted in any case.
  19. *
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  25. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  26. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  27. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  28. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  29. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  30. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. */
  33. #include <YSI\y_hooks>
  34. stock ShowVouchers(playerid, targetid)
  35. {
  36. if(IsPlayerConnected(targetid))
  37. {
  38. new szDialog[1024], szTitle[MAX_PLAYER_NAME+9];
  39. SetPVarInt(playerid, "WhoIsThis", targetid);
  40. format(szTitle, sizeof(szTitle), "%s Vouchers", GetPlayerNameEx(targetid));
  41. format(szDialog, sizeof(szDialog), "Car Voucher(s):\t\t\t{18F0F0}%d\nSilver VIP Voucher(s):\t\t{18F0F0}%d\nGold VIP Voucher(s):\t\t{18F0F0}%d\n1 month PVIP Voucher(s):\t{18F0F0}%d\nRestricted Car Voucher(s):\t{18F0F0}%d\nGift Reset Voucher(s):\t\t{18F0F0}%d\n" \
  42. "Priority Advert Voucher(s):\t{18F0F0}%d\n7 Days SVIP Voucher(s): \t{18F0F0}%d\n7 Days GVIP Voucher(s):\t{18F0F0}%d\n",
  43. PlayerInfo[targetid][pVehVoucher], PlayerInfo[targetid][pSVIPVoucher], PlayerInfo[targetid][pGVIPVoucher], PlayerInfo[targetid][pPVIPVoucher], PlayerInfo[targetid][pCarVoucher], PlayerInfo[targetid][pGiftVoucher], PlayerInfo[targetid][pAdvertVoucher], PlayerInfo[targetid][pSVIPExVoucher], PlayerInfo[targetid][pGVIPExVoucher]);
  44. ShowPlayerDialogEx(playerid, DIALOG_VOUCHER, DIALOG_STYLE_LIST, szTitle, szDialog, "Select", "Close");
  45. }
  46. return 1;
  47. }
  48. hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  49. if(arrAntiCheat[playerid][ac_iFlags][AC_DIALOGSPOOFING] > 0) return 1;
  50. szMiscArray[0] = 0;
  51. switch(dialogid)
  52. {
  53. case DIALOG_VOUCHER:
  54. {
  55. if(response)
  56. {
  57. new playeridd = GetPVarInt(playerid, "WhoIsThis");
  58. switch(listitem)
  59. {
  60. case 0: // Car Voucher
  61. {
  62. if(PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pTogReports] == 0 || PlayerInfo[playerid][pTogReports] == 0 && PlayerInfo[playerid][pASM] >= 1)
  63. {
  64. SetPVarInt(playerid, "voucherdialog", 1);
  65. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHERADMIN, DIALOG_STYLE_INPUT, "Voucher System", "Please enter how many would you like to give to this player.", "Enter", "Cancel");
  66. }
  67. else if(PlayerInfo[playeridd][pVehVoucher] > 0 && (playerid == playeridd))
  68. {
  69. SetPVarInt(playerid, "voucherdialog", 1);
  70. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHER2, DIALOG_STYLE_MSGBOX, "Voucher System", "Are you sure you want to use your car voucher?", "Yes", "No");
  71. }
  72. else if(PlayerInfo[playeridd][pVehVoucher] < 1)
  73. {
  74. if(PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pTogReports] == 0 || PlayerInfo[playerid][pTogReports] == 0 && PlayerInfo[playerid][pASM] >= 1)
  75. {
  76. SetPVarInt(playerid, "voucherdialog", 1);
  77. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHERADMIN, DIALOG_STYLE_INPUT, "Voucher System", "Please enter how many would you like to give to this player.", "Enter", "Cancel");
  78. }
  79. else
  80. {
  81. new szDialog[128];
  82. format(szDialog, sizeof(szDialog), "%s does not have any car vouchers.", GetPlayerNameEx(GetPVarInt(playerid, "WhoIsThis")));
  83. ShowPlayerDialogEx(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Voucher System", szDialog, "Close", "");
  84. DeletePVar(playerid, "WhoIsThis");
  85. }
  86. }
  87. }
  88. case 1: // SVIP Voucher
  89. {
  90. if(PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pTogReports] == 0 || PlayerInfo[playerid][pTogReports] == 0 && PlayerInfo[playerid][pASM] >= 1)
  91. {
  92. SetPVarInt(playerid, "voucherdialog", 2);
  93. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHERADMIN, DIALOG_STYLE_INPUT, "Voucher System", "Please enter how many would you like to give to this player.", "Enter", "Cancel");
  94. }
  95. else if(PlayerInfo[playeridd][pSVIPVoucher] > 0 && (playerid == playeridd))
  96. {
  97. SetPVarInt(playerid, "voucherdialog", 2);
  98. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHER2, DIALOG_STYLE_MSGBOX, "Voucher System", "Are you sure you want to use your Silver VIP voucher?", "Yes", "No");
  99. }
  100. else if(PlayerInfo[playeridd][pSVIPVoucher] < 1)
  101. {
  102. if(PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pTogReports] == 0 || PlayerInfo[playerid][pTogReports] == 0 && PlayerInfo[playerid][pASM] >= 1)
  103. {
  104. SetPVarInt(playerid, "voucherdialog", 2);
  105. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHERADMIN, DIALOG_STYLE_INPUT, "Voucher System", "Please enter how many would you like to give to this player.", "Enter", "Cancel");
  106. }
  107. else
  108. {
  109. new szDialog[128];
  110. format(szDialog, sizeof(szDialog), "%s does not have any Silver VIP vouchers.", GetPlayerNameEx(GetPVarInt(playerid, "WhoIsThis")));
  111. ShowPlayerDialogEx(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Voucher System", szDialog, "Close", "");
  112. DeletePVar(playerid, "WhoIsThis");
  113. }
  114. }
  115. }
  116. case 2: // GVIP Voucher
  117. {
  118. if(PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pTogReports] == 0 || PlayerInfo[playerid][pTogReports] == 0 && PlayerInfo[playerid][pASM] >= 1)
  119. {
  120. SetPVarInt(playerid, "voucherdialog", 3);
  121. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHERADMIN, DIALOG_STYLE_INPUT, "Voucher System", "Please enter how many would you like to give to this player.", "Enter", "Cancel");
  122. }
  123. else if(PlayerInfo[playeridd][pGVIPVoucher] > 0 && (playerid == playeridd))
  124. {
  125. SetPVarInt(playerid, "voucherdialog", 3);
  126. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHER2, DIALOG_STYLE_MSGBOX, "Voucher System", "Are you sure you want to use your Gold VIP voucher?", "Yes", "No");
  127. }
  128. else if(PlayerInfo[playeridd][pGVIPVoucher] < 1)
  129. {
  130. if(PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pTogReports] == 0 || PlayerInfo[playerid][pTogReports] == 0 && PlayerInfo[playerid][pASM] >= 1)
  131. {
  132. SetPVarInt(playerid, "voucherdialog", 3);
  133. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHERADMIN, DIALOG_STYLE_INPUT, "Voucher System", "Please enter how many would you like to give to this player.", "Enter", "Cancel");
  134. }
  135. else
  136. {
  137. new szDialog[128];
  138. format(szDialog, sizeof(szDialog), "%s does not have any Gold VIP vouchers.", GetPlayerNameEx(playeridd));
  139. ShowPlayerDialogEx(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Voucher System", szDialog, "Close", "");
  140. DeletePVar(playerid, "WhoIsThis");
  141. }
  142. }
  143. }
  144. case 3: // PVIP Voucher
  145. {
  146. if(playerid != playeridd) return 1;
  147. if(PlayerInfo[playeridd][pPVIPVoucher] < 1)
  148. {
  149. new szDialog[128];
  150. format(szDialog, sizeof(szDialog), "%s does not have any 1 month PVIP Vouchers.", GetPlayerNameEx(playeridd));
  151. DeletePVar(playerid, "WhoIsThis");
  152. return ShowPlayerDialogEx(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Voucher System", szDialog, "Close", "");
  153. }
  154. if(PlayerInfo[playerid][pDonateRank] >= 4) return SendClientMessageEx(playerid, COLOR_GRAD1, "You already have Platinum VIP+, you may sell this voucher with /sellvoucher."), DeletePVar(playerid, "WhoIsThis");
  155. ShowPlayerDialogEx(playerid, DIALOG_PVIPVOUCHER, DIALOG_STYLE_MSGBOX, "1 month PVIP Voucher", "You will be made Platinum VIP after use of this voucher.", "Confirm", "Cancel");
  156. }
  157. case 4: // Restricted Car Voucher
  158. {
  159. if(playerid != playeridd) return 1;
  160. if(ShopClosed == 1) return SendClientMessageEx(playerid, COLOR_GREY, "The shop is currently closed.");
  161. if(PlayerInfo[playeridd][pCarVoucher] < 1)
  162. {
  163. new szDialog[128];
  164. format(szDialog, sizeof(szDialog), "%s does not have any Restriced Car vouchers.", GetPlayerNameEx(playeridd));
  165. DeletePVar(playerid, "WhoIsThis");
  166. return ShowPlayerDialogEx(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Voucher System", szDialog, "Close", "");
  167. }
  168. if(!IsPlayerInDynamicArea(playerid, NGGShop) && GetPlayerVirtualWorld(playerid) != 1) return SendClientMessageEx(playerid, COLOR_GRAD2, "You must be at NGG's shop to redeem this voucher.");
  169. ShowModelSelectionMenu(playerid, CarList3, "Car Shop");
  170. }
  171. case 5: // Gift Reset Voucher
  172. {
  173. if((PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pHR] >= 1) && PlayerInfo[playerid][pTogReports] == 0)
  174. {
  175. SetPVarInt(playerid, "voucherdialog", 4);
  176. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHERADMIN, DIALOG_STYLE_INPUT, "Voucher System", "Please enter how many would you like to give to this player.", "Enter", "Cancel");
  177. }
  178. else if(PlayerInfo[playeridd][pGiftVoucher] > 0 && (playerid == playeridd))
  179. {
  180. SetPVarInt(playerid, "voucherdialog", 4);
  181. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHER2, DIALOG_STYLE_MSGBOX, "Voucher System", "Are you sure you want to use your Gift Reset Voucher?", "Yes", "No");
  182. }
  183. else if(PlayerInfo[playeridd][pGiftVoucher] < 1)
  184. {
  185. if((PlayerInfo[playerid][pAdmin] >= 1337 || PlayerInfo[playerid][pHR] >= 1) && PlayerInfo[playerid][pTogReports] == 0)
  186. {
  187. SetPVarInt(playerid, "voucherdialog", 4);
  188. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHERADMIN, DIALOG_STYLE_INPUT, "Voucher System", "Please enter how many would you like to give to this player.", "Enter", "Cancel");
  189. }
  190. else
  191. {
  192. new szDialog[128];
  193. format(szDialog, sizeof(szDialog), "%s does not have any Gift Reset vouchers.", GetPlayerNameEx(playeridd));
  194. ShowPlayerDialogEx(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Voucher System", szDialog, "Close", "");
  195. DeletePVar(playerid, "WhoIsThis");
  196. }
  197. }
  198. }
  199. case 6: // Priority Advertisement Voucher
  200. {
  201. if(PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pTogReports] == 0 || PlayerInfo[playerid][pTogReports] == 0 && PlayerInfo[playerid][pASM] >= 1)
  202. {
  203. SetPVarInt(playerid, "voucherdialog", 5);
  204. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHERADMIN, DIALOG_STYLE_INPUT, "Voucher System", "Please enter how many would you like to give to this player.", "Enter", "Cancel");
  205. }
  206. else if(PlayerInfo[playeridd][pAdvertVoucher] > 0 && (playerid == playeridd))
  207. {
  208. return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot use your voucher through here, you will be prompt a dialog while in the advertisement menu to use this voucher.");
  209. }
  210. else if(PlayerInfo[playeridd][pAdvertVoucher] < 1)
  211. {
  212. if(PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pTogReports] == 0 || PlayerInfo[playerid][pTogReports] == 0 && PlayerInfo[playerid][pASM] >= 1)
  213. {
  214. SetPVarInt(playerid, "voucherdialog", 5);
  215. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHERADMIN, DIALOG_STYLE_INPUT, "Voucher System", "Please enter how many would you like to give to this player.", "Enter", "Cancel");
  216. }
  217. else
  218. {
  219. new szDialog[128];
  220. format(szDialog, sizeof(szDialog), "%s does not have any Priority Advertisement vouchers.", GetPlayerNameEx(playeridd));
  221. ShowPlayerDialogEx(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Voucher System", szDialog, "Close", "");
  222. DeletePVar(playerid, "WhoIsThis");
  223. }
  224. }
  225. }
  226. case 7: // 7 Days Silver VIP
  227. {
  228. if(PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pTogReports] == 0 || PlayerInfo[playerid][pTogReports] == 0 && PlayerInfo[playerid][pASM] >= 1)
  229. {
  230. SetPVarInt(playerid, "voucherdialog", 6);
  231. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHERADMIN, DIALOG_STYLE_INPUT, "Voucher System", "Please enter how many would you like to give to this player.", "Enter", "Cancel");
  232. }
  233. else if(PlayerInfo[playeridd][pSVIPExVoucher] > 0 && (playerid == playeridd))
  234. {
  235. SetPVarInt(playerid, "voucherdialog", 5);
  236. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHER2, DIALOG_STYLE_MSGBOX, "Voucher System", "Are you sure you want to use your 7 Days Silver VIP voucher?", "Yes", "No");
  237. }
  238. else if(PlayerInfo[playeridd][pSVIPExVoucher] < 1)
  239. {
  240. if(PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pTogReports] == 0 || PlayerInfo[playerid][pTogReports] == 0 && PlayerInfo[playerid][pASM] >= 1)
  241. {
  242. SetPVarInt(playerid, "voucherdialog", 6);
  243. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHERADMIN, DIALOG_STYLE_INPUT, "Voucher System", "Please enter how many would you like to give to this player.", "Enter", "Cancel");
  244. }
  245. else
  246. {
  247. new szDialog[128];
  248. format(szDialog, sizeof(szDialog), "%s does not have any 7 Days Silver VIP vouchers.", GetPlayerNameEx(playeridd));
  249. ShowPlayerDialogEx(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Voucher System", szDialog, "Close", "");
  250. DeletePVar(playerid, "WhoIsThis");
  251. }
  252. }
  253. }
  254. case 8: // 7 Days Gold VIP
  255. {
  256. if(PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pTogReports] == 0 || PlayerInfo[playerid][pTogReports] == 0 && PlayerInfo[playerid][pASM] >= 1)
  257. {
  258. SetPVarInt(playerid, "voucherdialog", 7);
  259. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHERADMIN, DIALOG_STYLE_INPUT, "Voucher System", "Please enter how many would you like to give to this player.", "Enter", "Cancel");
  260. }
  261. else if(PlayerInfo[playeridd][pGVIPExVoucher] > 0 && (playerid == playeridd))
  262. {
  263. SetPVarInt(playerid, "voucherdialog", 6);
  264. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHER2, DIALOG_STYLE_MSGBOX, "Voucher System", "Are you sure you want to use your 7 Days Gold VIP voucher?", "Yes", "No");
  265. }
  266. else if(PlayerInfo[playeridd][pGVIPExVoucher] < 1)
  267. {
  268. if(PlayerInfo[playerid][pAdmin] >= 4 && PlayerInfo[playerid][pTogReports] == 0 || PlayerInfo[playerid][pTogReports] == 0 && PlayerInfo[playerid][pASM] >= 1)
  269. {
  270. SetPVarInt(playerid, "voucherdialog", 7);
  271. return ShowPlayerDialogEx(playerid, DIALOG_VOUCHERADMIN, DIALOG_STYLE_INPUT, "Voucher System", "Please enter how many would you like to give to this player.", "Enter", "Cancel");
  272. }
  273. else
  274. {
  275. new szDialog[128];
  276. format(szDialog, sizeof(szDialog), "%s does not have any 7 Days Gold VIP vouchers.", GetPlayerNameEx(playeridd));
  277. ShowPlayerDialogEx(playerid, DIALOG_NOTHING, DIALOG_STYLE_MSGBOX, "Voucher System", szDialog, "Close", "");
  278. DeletePVar(playerid, "WhoIsThis");
  279. }
  280. }
  281. }
  282. }
  283. }
  284. }
  285. case DIALOG_VOUCHERADMIN:
  286. {
  287. if(response)
  288. {
  289. if(!isnull(inputtext))
  290. {
  291. if(IsNumeric(inputtext))
  292. {
  293. if(!IsPlayerConnected(GetPVarInt(playerid, "WhoIsThis"))) return SendClientMessageEx(playerid, COLOR_GRAD1, "This player has disconnected from the server.");
  294. if(strval(inputtext) < 1) return DeletePVar(playerid, "voucherdialog"), DeletePVar(playerid, "WhoIsThis"), SendClientMessageEx(playerid, COLOR_GRAD1, "You can't give less than 1 voucher.");
  295. if(GetPVarInt(playerid, "voucherdialog") == 1) // Car Voucher
  296. {
  297. new targetid = GetPVarInt(playerid, "WhoIsThis"),
  298. amount = strval(inputtext),
  299. szString[128];
  300. PlayerInfo[targetid][pVehVoucher] += amount;
  301. format(szString, sizeof(szString), "You have given %s %d car voucher(s).", GetPlayerNameEx(targetid), amount);
  302. SendClientMessageEx(playerid, COLOR_CYAN, szString);
  303. format(szString, sizeof(szString), "You have been given %d car voucher(s) by %s.", amount, GetPlayerNameEx(playerid));
  304. SendClientMessageEx(targetid, COLOR_CYAN, szString);
  305. format(szString, sizeof(szString), "%s has given %s(%d) %d car voucher(s).", GetPlayerNameEx(playerid), GetPlayerNameEx(targetid), GetPlayerSQLId(targetid), amount);
  306. Log("logs/vouchers.log", szString);
  307. }
  308. if(GetPVarInt(playerid, "voucherdialog") == 2) // SVIP Voucher
  309. {
  310. new targetid = GetPVarInt(playerid, "WhoIsThis"),
  311. amount = strval(inputtext),
  312. szString[128];
  313. PlayerInfo[targetid][pSVIPVoucher] += amount;
  314. format(szString, sizeof(szString), "You have given %s %d Silver VIP voucher(s).", GetPlayerNameEx(targetid), amount);
  315. SendClientMessageEx(playerid, COLOR_CYAN, szString);
  316. format(szString, sizeof(szString), "You have been given %d Silver VIP voucher(s) by %s.", amount, GetPlayerNameEx(playerid));
  317. SendClientMessageEx(targetid, COLOR_CYAN, szString);
  318. format(szString, sizeof(szString), "%s has given %s(%d) %d Silver VIP voucher(s).", GetPlayerNameEx(playerid), GetPlayerNameEx(targetid), GetPlayerSQLId(targetid), amount);
  319. Log("logs/vouchers.log", szString);
  320. }
  321. if(GetPVarInt(playerid, "voucherdialog") == 3) // GVIP Voucher
  322. {
  323. new targetid = GetPVarInt(playerid, "WhoIsThis"),
  324. amount = strval(inputtext),
  325. szString[128];
  326. PlayerInfo[targetid][pGVIPVoucher] += amount;
  327. format(szString, sizeof(szString), "You have given %s %d Gold VIP voucher(s).", GetPlayerNameEx(targetid), amount);
  328. SendClientMessageEx(playerid, COLOR_CYAN, szString);
  329. format(szString, sizeof(szString), "You have been given %d Gold VIP voucher(s) by %s.", amount, GetPlayerNameEx(playerid));
  330. SendClientMessageEx(targetid, COLOR_CYAN, szString);
  331. format(szString, sizeof(szString), "%s has given %s(%d) %d Gold VIP voucher(s).", GetPlayerNameEx(playerid), GetPlayerNameEx(targetid), GetPlayerSQLId(targetid), amount);
  332. Log("logs/vouchers.log", szString);
  333. }
  334. if(GetPVarInt(playerid, "voucherdialog") == 4) // Gift Reset Voucher
  335. {
  336. new targetid = GetPVarInt(playerid, "WhoIsThis"),
  337. amount = strval(inputtext),
  338. szString[128];
  339. PlayerInfo[targetid][pGiftVoucher] += amount;
  340. format(szString, sizeof(szString), "You have given %s %d Gift Reset voucher(s).", GetPlayerNameEx(targetid), amount);
  341. SendClientMessageEx(playerid, COLOR_CYAN, szString);
  342. format(szString, sizeof(szString), "You have been given %d Gift Reset voucher(s) by %s.", amount, GetPlayerNameEx(playerid));
  343. SendClientMessageEx(targetid, COLOR_CYAN, szString);
  344. format(szString, sizeof(szString), "[Admin] %s(IP:%s) has given %s(%d)(IP:%s) %d free gift reset voucher(s).", GetPlayerNameEx(playerid), GetPlayerIpEx(playerid), GetPlayerNameEx(targetid), GetPlayerSQLId(targetid), GetPlayerIpEx(targetid), amount);
  345. Log("logs/adminrewards.log", szString);
  346. }
  347. if(GetPVarInt(playerid, "voucherdialog") == 5) // Priority Advertisement Voucher
  348. {
  349. new targetid = GetPVarInt(playerid, "WhoIsThis"),
  350. amount = strval(inputtext),
  351. szString[128];
  352. PlayerInfo[targetid][pAdvertVoucher] += amount;
  353. format(szString, sizeof(szString), "You have given %s %d Priority Advertisement voucher(s).", GetPlayerNameEx(targetid), amount);
  354. SendClientMessageEx(playerid, COLOR_CYAN, szString);
  355. format(szString, sizeof(szString), "You have been given %d Priority Advertisement voucher(s) by %s.", amount, GetPlayerNameEx(playerid));
  356. SendClientMessageEx(targetid, COLOR_CYAN, szString);
  357. format(szString, sizeof(szString), "[Admin] %s(IP:%s) has given %s(%d)(IP:%s) %d free Priority Advertisement voucher(s).", GetPlayerNameEx(playerid), GetPlayerIpEx(playerid), GetPlayerNameEx(targetid), GetPlayerSQLId(targetid), GetPlayerIpEx(targetid), amount);
  358. Log("logs/vouchers.log", szString);
  359. }
  360. if(GetPVarInt(playerid, "voucherdialog") == 6) // 7 Days Silver VIP Voucher
  361. {
  362. new targetid = GetPVarInt(playerid, "WhoIsThis"),
  363. amount = strval(inputtext),
  364. szString[128];
  365. PlayerInfo[targetid][pSVIPExVoucher] += amount;
  366. format(szString, sizeof(szString), "You have given %s %d 7 Days Silver VIP voucher(s).", GetPlayerNameEx(targetid), amount);
  367. SendClientMessageEx(playerid, COLOR_CYAN, szString);
  368. format(szString, sizeof(szString), "You have been given %d 7 Days Silver VIP voucher(s) by %s.", amount, GetPlayerNameEx(playerid));
  369. SendClientMessageEx(targetid, COLOR_CYAN, szString);
  370. format(szString, sizeof(szString), "[Admin] %s(IP:%s) has given %s(%d)(IP:%s) %d free 7 Days Silver VIP voucher(s).", GetPlayerNameEx(playerid), GetPlayerIpEx(playerid), GetPlayerNameEx(targetid), GetPlayerSQLId(targetid), GetPlayerIpEx(targetid), amount);
  371. Log("logs/vouchers.log", szString);
  372. }
  373. if(GetPVarInt(playerid, "voucherdialog") == 7) // 7 Days Gold VIP Voucher
  374. {
  375. new targetid = GetPVarInt(playerid, "WhoIsThis"),
  376. amount = strval(inputtext),
  377. szString[128];
  378. PlayerInfo[targetid][pGVIPExVoucher] += amount;
  379. format(szString, sizeof(szString), "You have given %s %d 7 Days Gold VIP voucher(s).", GetPlayerNameEx(targetid), amount);
  380. SendClientMessageEx(playerid, COLOR_CYAN, szString);
  381. format(szString, sizeof(szString), "You have been given %d 7 Days Gold VIP voucher(s) by %s.", amount, GetPlayerNameEx(playerid));
  382. SendClientMessageEx(targetid, COLOR_CYAN, szString);
  383. format(szString, sizeof(szString), "[Admin] %s(IP:%s) has given %s(%d)(IP:%s) %d free 7 Days Gold VIP voucher(s).", GetPlayerNameEx(playerid), GetPlayerIpEx(playerid), GetPlayerNameEx(targetid), GetPlayerSQLId(targetid), GetPlayerIpEx(targetid), amount);
  384. Log("logs/vouchers.log", szString);
  385. }
  386. }
  387. else ShowPlayerDialogEx(playerid, DIALOG_VOUCHERADMIN, DIALOG_STYLE_INPUT, "Voucher System - {FF0000}That's not a number", "Please enter how many would you like to give to this player.", "Enter", "Cancel");
  388. }
  389. else ShowPlayerDialogEx(playerid, DIALOG_VOUCHERADMIN, DIALOG_STYLE_INPUT, "Voucher System ", "Please enter how many would you like to give to this player.", "Enter", "Cancel");
  390. }
  391. DeletePVar(playerid, "voucherdialog");
  392. DeletePVar(playerid, "WhoIsThis");
  393. }
  394. case DIALOG_VOUCHER2:
  395. {
  396. if(response) // Clicked "Use"
  397. {
  398. if(PlayerInfo[playerid][pJailTime] > 0)
  399. {
  400. DeletePVar(playerid, "voucherdialog");
  401. DeletePVar(playerid, "WhoIsThis");
  402. return SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot use this command while being in jail/prison.");
  403. }
  404. if(GetPVarInt(playerid, "voucherdialog") == 1) // Car Voucher
  405. {
  406. if(GetPlayerInterior(playerid) != 0 || !IsPlayerInDynamicArea(playerid, NGGShop))
  407. {
  408. DeletePVar(playerid, "voucherdialog");
  409. DeletePVar(playerid, "WhoIsThis");
  410. if(GetPlayerInterior(playerid) != 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot use this while being inside an interior.");
  411. if(!IsPlayerInDynamicArea(playerid, NGGShop) && GetPlayerVirtualWorld(playerid) != 1) return SendClientMessageEx(playerid, COLOR_GRAD2, "You must be at NGG's shop to redeem this voucher.");
  412. }
  413. else
  414. {
  415. return ShowModelSelectionMenu(playerid, CarList2, "Car Voucher Selection");
  416. }
  417. }
  418. if(GetPVarInt(playerid, "voucherdialog") == 2) // SVIP Voucher
  419. {
  420. if(PlayerInfo[playerid][pDonateRank] >= 2)
  421. {
  422. DeletePVar(playerid, "voucherdialog");
  423. DeletePVar(playerid, "WhoIsThis");
  424. return SendClientMessageEx(playerid, COLOR_GRAD2, "Your VIP Level is already set to Silver+");
  425. }
  426. if(PlayerInfo[playerid][pSVIPVoucher] <= 0) return DeletePVar(playerid, "voucherdialog"), DeletePVar(playerid, "WhoIsThis"), SendClientMessageEx(playerid, COLOR_GREY, "You don't have a SVIP Voucher.");
  427. PlayerInfo[playerid][pSVIPVoucher]--;
  428. PlayerInfo[playerid][pDonateRank] = 2;
  429. PlayerInfo[playerid][pTempVIP] = 0;
  430. PlayerInfo[playerid][pBuddyInvited] = 0;
  431. PlayerInfo[playerid][pVIPSellable] = 0;
  432. PlayerInfo[playerid][pVIPExpire] = gettime()+2592000*1;
  433. if(PlayerInfo[playerid][pVIPM] == 0)
  434. {
  435. PlayerInfo[playerid][pVIPM] = VIPM;
  436. VIPM++;
  437. }
  438. LoadPlayerDisabledVehicles(playerid);
  439. new playerip[32];
  440. GetPlayerIp(playerid, playerip, sizeof(playerip));
  441. format(szMiscArray, sizeof(szMiscArray), "AdmCmd: Server (Voucher System) has set %s's VIP level to Silver (2).", GetPlayerNameEx(playerid));
  442. ABroadCast(COLOR_LIGHTRED, szMiscArray, 4);
  443. format(szMiscArray, sizeof(szMiscArray), "You have successfully used one of your Silver VIP voucher(s), you have %d Silver VIP voucher(s) left.", PlayerInfo[playerid][pSVIPVoucher]);
  444. SendClientMessageEx(playerid, COLOR_CYAN, szMiscArray);
  445. SendClientMessageEx(playerid, COLOR_GRAD2, "** Note: Your Silver VIP will expire in 30 days.");
  446. format(szMiscArray, sizeof(szMiscArray), "AdmCmd: Server (Voucher System) has set %s's(%d) (IP:%s) VIP level to Silver (2) (Voucher Left: %d)", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), playerip, PlayerInfo[playerid][pSVIPVoucher]);
  447. Log("logs/vouchers.log", szMiscArray);
  448. OnPlayerStatsUpdate(playerid);
  449. }
  450. if(GetPVarInt(playerid, "voucherdialog") == 3) // GVIP Voucher - Not renewable
  451. {
  452. if(PlayerInfo[playerid][pDonateRank] >= 3)
  453. {
  454. DeletePVar(playerid, "voucherdialog");
  455. DeletePVar(playerid, "WhoIsThis");
  456. return SendClientMessageEx(playerid, COLOR_GRAD2, "Your VIP Level is already set to Gold+");
  457. }
  458. if(PlayerInfo[playerid][pGVIPVoucher] <= 0) return DeletePVar(playerid, "voucherdialog"), DeletePVar(playerid, "WhoIsThis"), SendClientMessageEx(playerid, COLOR_GREY, "You don't have a GVIP Voucher.");
  459. PlayerInfo[playerid][pGVIPVoucher]--;
  460. PlayerInfo[playerid][pDonateRank] = 3;
  461. PlayerInfo[playerid][pTempVIP] = 0;
  462. PlayerInfo[playerid][pBuddyInvited] = 0;
  463. PlayerInfo[playerid][pVIPSellable] = 0;
  464. PlayerInfo[playerid][pVIPExpire] = gettime()+2592000*1;
  465. if(PlayerInfo[playerid][pVIPM] == 0)
  466. {
  467. PlayerInfo[playerid][pVIPM] = VIPM;
  468. VIPM++;
  469. }
  470. LoadPlayerDisabledVehicles(playerid);
  471. new playerip[32];
  472. GetPlayerIp(playerid, playerip, sizeof(playerip));
  473. format(szMiscArray, sizeof(szMiscArray), "AdmCmd: Server (Voucher System) has set %s's VIP level to Gold (3).", GetPlayerNameEx(playerid));
  474. ABroadCast(COLOR_LIGHTRED, szMiscArray, 4);
  475. format(szMiscArray, sizeof(szMiscArray), "You have successfully used one of your Gold VIP voucher(s), you have %d Gold VIP voucher(s) left.", PlayerInfo[playerid][pGVIPVoucher]);
  476. SendClientMessageEx(playerid, COLOR_CYAN, szMiscArray);
  477. SendClientMessageEx(playerid, COLOR_GRAD2, "** Note: Your Gold VIP will expire in 30 days.");
  478. format(szMiscArray, sizeof(szMiscArray), "AdmCmd: Server (Voucher System) has set %s's(%d) (IP:%s) VIP level to Gold (3) (Voucher Left: %d)", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), playerip, PlayerInfo[playerid][pGVIPVoucher]);
  479. Log("logs/vouchers.log", szMiscArray);
  480. OnPlayerStatsUpdate(playerid);
  481. }
  482. if(GetPVarInt(playerid, "voucherdialog") == 4) // Gift Reset Voucher
  483. {
  484. if(PlayerInfo[playerid][pGiftTime] <= 0)
  485. {
  486. DeletePVar(playerid, "voucherdialog");
  487. DeletePVar(playerid, "WhoIsThis");
  488. return SendClientMessageEx(playerid, COLOR_GRAD2, "You're already able to to receive a gift from the giftbox or the safe.");
  489. }
  490. if(PlayerInfo[playerid][pGiftVoucher] <= 0) return DeletePVar(playerid, "voucherdialog"), DeletePVar(playerid, "WhoIsThis"), SendClientMessageEx(playerid, COLOR_GREY, "You don't have a Gift Reset Voucher.");
  491. PlayerInfo[playerid][pGiftVoucher]--;
  492. PlayerInfo[playerid][pGiftTime] = 0;
  493. new playerip[32];
  494. GetPlayerIp(playerid, playerip, sizeof(playerip));
  495. format(szMiscArray, sizeof(szMiscArray), "You have successfully used one of your Gift Reset voucher(s), you have %d Gift Reset voucher(s) left.", PlayerInfo[playerid][pGiftVoucher]);
  496. SendClientMessageEx(playerid, COLOR_CYAN, szMiscArray);
  497. SendClientMessageEx(playerid, COLOR_GRAD2, "** Note: You may now get another gift.");
  498. format(szMiscArray, sizeof(szMiscArray), "%s(%d)(IP:%s) has used a Gift Reset Voucher. (Vouchers Left: %d)", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), playerip, PlayerInfo[playerid][pGiftVoucher]);
  499. Log("logs/vouchers.log", szMiscArray);
  500. OnPlayerStatsUpdate(playerid);
  501. }
  502. if(GetPVarInt(playerid, "voucherdialog") == 5) // 7 Days Silver VIP
  503. {
  504. if(PlayerInfo[playerid][pDonateRank] >= 2)
  505. {
  506. DeletePVar(playerid, "voucherdialog");
  507. DeletePVar(playerid, "WhoIsThis");
  508. return SendClientMessageEx(playerid, COLOR_GRAD2, "Your VIP Level is already set to Silver+");
  509. }
  510. if(PlayerInfo[playerid][pSVIPExVoucher] <= 0) return DeletePVar(playerid, "voucherdialog"), DeletePVar(playerid, "WhoIsThis"), SendClientMessageEx(playerid, COLOR_GREY, "You don't have a 7 Day Silver VIP Voucher.");
  511. PlayerInfo[playerid][pSVIPExVoucher]--;
  512. PlayerInfo[playerid][pDonateRank] = 2;
  513. PlayerInfo[playerid][pTempVIP] = 0;
  514. PlayerInfo[playerid][pBuddyInvited] = 0;
  515. PlayerInfo[playerid][pVIPSellable] = 1;
  516. PlayerInfo[playerid][pVIPExpire] = gettime()+604800*1;
  517. if(PlayerInfo[playerid][pVIPM] == 0)
  518. {
  519. PlayerInfo[playerid][pVIPM] = VIPM;
  520. VIPM++;
  521. }
  522. LoadPlayerDisabledVehicles(playerid);
  523. new playerip[32];
  524. GetPlayerIp(playerid, playerip, sizeof(playerip));
  525. format(szMiscArray, sizeof(szMiscArray), "AdmCmd: Server (Voucher System) has set %s's VIP level to Silver (7 Days)(3).", GetPlayerNameEx(playerid));
  526. ABroadCast(COLOR_LIGHTRED, szMiscArray, 4);
  527. format(szMiscArray, sizeof(szMiscArray), "You have successfully used one of your 7 Days Silver VIP voucher(s), you have %d 7 Days Silver VIP voucher(s) left.", PlayerInfo[playerid][pSVIPExVoucher]);
  528. SendClientMessageEx(playerid, COLOR_CYAN, szMiscArray);
  529. SendClientMessageEx(playerid, COLOR_GRAD2, "** Note: Your Silver VIP will expire in 7 days.");
  530. format(szMiscArray, sizeof(szMiscArray), "AdmCmd: Server (Voucher System) has set %s's(%d) (IP:%s) VIP level to Silver (7 Days)(3) (Voucher Left: %d)", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), playerip, PlayerInfo[playerid][pSVIPExVoucher]);
  531. Log("logs/vouchers.log", szMiscArray);
  532. OnPlayerStatsUpdate(playerid);
  533. }
  534. if(GetPVarInt(playerid, "voucherdialog") == 6) // 7 Days Gold VIP
  535. {
  536. if(PlayerInfo[playerid][pDonateRank] >= 3)
  537. {
  538. DeletePVar(playerid, "voucherdialog");
  539. DeletePVar(playerid, "WhoIsThis");
  540. return SendClientMessageEx(playerid, COLOR_GRAD2, "Your VIP Level is already set to Gold+");
  541. }
  542. if(PlayerInfo[playerid][pGVIPExVoucher] <= 0) return DeletePVar(playerid, "voucherdialog"), DeletePVar(playerid, "WhoIsThis"), SendClientMessageEx(playerid, COLOR_GREY, "You don't have a 7 Day Gold VIP Voucher.");
  543. PlayerInfo[playerid][pGVIPExVoucher]--;
  544. PlayerInfo[playerid][pDonateRank] = 3;
  545. PlayerInfo[playerid][pTempVIP] = 0;
  546. PlayerInfo[playerid][pBuddyInvited] = 0;
  547. PlayerInfo[playerid][pVIPSellable] = 1;
  548. PlayerInfo[playerid][pVIPExpire] = gettime()+604800*1;
  549. if(PlayerInfo[playerid][pVIPM] == 0)
  550. {
  551. PlayerInfo[playerid][pVIPM] = VIPM;
  552. VIPM++;
  553. }
  554. LoadPlayerDisabledVehicles(playerid);
  555. new playerip[32];
  556. GetPlayerIp(playerid, playerip, sizeof(playerip));
  557. format(szMiscArray, sizeof(szMiscArray), "AdmCmd: Server (Voucher System) has set %s's VIP level to Gold (7 Days)(3).", GetPlayerNameEx(playerid));
  558. ABroadCast(COLOR_LIGHTRED, szMiscArray, 4);
  559. format(szMiscArray, sizeof(szMiscArray), "You have successfully used one of your 7 Days Gold VIP voucher(s), you have %d 7 Days Gold VIP voucher(s) left.", PlayerInfo[playerid][pGVIPExVoucher]);
  560. SendClientMessageEx(playerid, COLOR_CYAN, szMiscArray);
  561. SendClientMessageEx(playerid, COLOR_GRAD2, "** Note: Your Gold VIP will expire in 7 days.");
  562. format(szMiscArray, sizeof(szMiscArray), "AdmCmd: Server (Voucher System) has set %s's(%d) (IP:%s) VIP level to Gold (7 Days)(3) (Voucher Left: %d)", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), playerip, PlayerInfo[playerid][pGVIPExVoucher]);
  563. Log("logs/vouchers.log", szMiscArray);
  564. OnPlayerStatsUpdate(playerid);
  565. }
  566. }
  567. DeletePVar(playerid, "voucherdialog");
  568. DeletePVar(playerid, "WhoIsThis");
  569. }
  570. }
  571. return 0;
  572. }
  573. // Start of the voucher commands
  574. CMD:myvouchers(playerid, params[])
  575. {
  576. if(PlayerInfo[playerid][pJailTime] > 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot use this command while being in jail/prison.");
  577. ShowVouchers(playerid, playerid);
  578. return 1;
  579. }
  580. CMD:checkvouchers(playerid, params[])
  581. {
  582. new targetid;
  583. if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pASM] < 1) return SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  584. if(sscanf(params, "u", targetid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /checkvouchers [player]");
  585. if(!IsPlayerConnected(targetid)) return SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
  586. ShowVouchers(playerid, targetid);
  587. return 1;
  588. }
  589. CMD:sellvoucher(playerid, params[])
  590. {
  591. new choice[32], amount, price, buyer;
  592. if(sscanf(params, "s[32]ddu", choice, amount, price, buyer))
  593. {
  594. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /sellvoucher [name] [amount] [price] [buyer]");
  595. SendClientMessageEx(playerid, COLOR_GREY, "Available names: CarVoucher, SilverVIP, GoldVIP, PVIP, RestrictedCar, Advert, 7DaySVIP, 7DayGVIP");
  596. return 1;
  597. }
  598. new Float: bPos[3];
  599. GetPlayerPos(buyer, bPos[0], bPos[1], bPos[2]);
  600. if(GetPlayerVirtualWorld(buyer) != GetPlayerVirtualWorld(playerid)) return SendClientMessageEx(playerid, COLOR_GRAD1, "You're not near this player.");
  601. if(price < 1 || price > 99999999) return SendClientMessageEx(playerid, COLOR_GRAD1, "You must specify a price greater than $0 or less than $99,999,999.");
  602. if(amount < 1) return SendClientMessageEx(playerid, COLOR_GREY, "Invalid amount specified.");
  603. if(!IsPlayerConnected(buyer)) return SendClientMessageEx(playerid, COLOR_GRAD1, "This player isn't connected.");
  604. if(!IsPlayerInRangeOfPoint(playerid, 5.0, bPos[0], bPos[1], bPos[2])) return SendClientMessageEx(playerid, COLOR_GRAD1, "You're not near this player.");
  605. if(GetPVarInt(playerid, "Injured") != 0 || PlayerCuffed[playerid] != 0 || PlayerInfo[playerid][pJailTime] > 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You can't do that right now.");
  606. if(GetPVarInt(buyer, "Injured") != 0 || PlayerCuffed[buyer] != 0 || PlayerInfo[buyer][pJailTime] > 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You can't offer a Prisoner or a Injured player a voucher.");
  607. if(GetPVarType(buyer, "buyingVoucher")) return SendClientMessageEx(playerid, COLOR_GRAD1, "This player is already buying another voucher, please try again later.");
  608. new string[128];
  609. if(strcmp(choice, "carvoucher", true) == 0)
  610. {
  611. if(amount > PlayerInfo[playerid][pVehVoucher]) return SendClientMessageEx(playerid, COLOR_GRAD1, "You do not have that much vouchers.");
  612. SetPVarInt(buyer, "priceVoucher", price);
  613. SetPVarInt(buyer, "amountVoucher", amount);
  614. SetPVarInt(buyer, "buyingVoucher", 1);
  615. SetPVarInt(buyer, "sellerVoucher", playerid);
  616. SetPVarInt(playerid, "buyerVoucher", buyer);
  617. format(string, sizeof(string), "%s has offered to sell you %d car voucher(s) for $%s - Type /accept voucher or /denyvoucher.", GetPlayerNameEx(playerid), amount, number_format(price));
  618. SendClientMessageEx(buyer, COLOR_LIGHTBLUE, string);
  619. format(string, sizeof(string), "You have offered %s %d car voucher(s) for $%s, please wait until he accept/decline the offer.", GetPlayerNameEx(buyer), amount, number_format(price));
  620. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  621. SetPVarInt(buyer, "SQLID_Voucher", GetPlayerSQLId(playerid));
  622. }
  623. else if(strcmp(choice, "silvervip", true) == 0)
  624. {
  625. if(amount > PlayerInfo[playerid][pSVIPVoucher]) return SendClientMessageEx(playerid, COLOR_GRAD1, "You do not have that much vouchers.");
  626. SetPVarInt(buyer, "priceVoucher", price);
  627. SetPVarInt(buyer, "amountVoucher", amount);
  628. SetPVarInt(buyer, "buyingVoucher", 2);
  629. SetPVarInt(buyer, "sellerVoucher", playerid);
  630. SetPVarInt(playerid, "buyerVoucher", buyer);
  631. format(string, sizeof(string), "%s has offered to sell you %d Silver VIP voucher(s) for $%s - Type /accept voucher or /denyvoucher.", GetPlayerNameEx(playerid), amount, number_format(price));
  632. SendClientMessageEx(buyer, COLOR_LIGHTBLUE, string);
  633. format(string, sizeof(string), "You have offered %s %d Silver VIP voucher(s) for $%s, please wait until he accept/decline the offer.", GetPlayerNameEx(buyer), amount, number_format(price));
  634. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  635. SetPVarInt(buyer, "SQLID_Voucher", GetPlayerSQLId(playerid));
  636. }
  637. else if(strcmp(choice, "goldvip", true) == 0)
  638. {
  639. if(amount > PlayerInfo[playerid][pGVIPVoucher]) return SendClientMessageEx(playerid, COLOR_GRAD1, "You do not have that much vouchers.");
  640. SetPVarInt(buyer, "priceVoucher", price);
  641. SetPVarInt(buyer, "amountVoucher", amount);
  642. SetPVarInt(buyer, "buyingVoucher", 3);
  643. SetPVarInt(buyer, "sellerVoucher", playerid);
  644. SetPVarInt(playerid, "buyerVoucher", buyer);
  645. format(string, sizeof(string), "%s has offered to sell you %d Gold VIP voucher(s) for $%s - Type /accept voucher or /denyvoucher.", GetPlayerNameEx(playerid), amount, number_format(price));
  646. SendClientMessageEx(buyer, COLOR_LIGHTBLUE, string);
  647. format(string, sizeof(string), "You have offered %s %d Gold VIP voucher(s) for $%s, please wait until he accept/decline the offer.", GetPlayerNameEx(buyer), amount, number_format(price));
  648. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  649. SetPVarInt(buyer, "SQLID_Voucher", GetPlayerSQLId(playerid));
  650. }
  651. else if(strcmp(choice, "pvip", true) == 0)
  652. {
  653. if(amount > PlayerInfo[playerid][pPVIPVoucher]) return SendClientMessageEx(playerid, COLOR_GRAD1, "You do not have that much vouchers.");
  654. SetPVarInt(buyer, "priceVoucher", price);
  655. SetPVarInt(buyer, "amountVoucher", amount);
  656. SetPVarInt(buyer, "buyingVoucher", 4);
  657. SetPVarInt(buyer, "sellerVoucher", playerid);
  658. SetPVarInt(playerid, "buyerVoucher", buyer);
  659. format(string, sizeof(string), "%s has offered to sell you %d 1 month PVIP Voucher(s) for $%s - Type /accept voucher or /denyvoucher.", GetPlayerNameEx(playerid), amount, number_format(price));
  660. SendClientMessageEx(buyer, COLOR_LIGHTBLUE, string);
  661. format(string, sizeof(string), "You have offered %s %d 1 month PVIP Voucher(s) for $%s, please wait until he accept/decline the offer.", GetPlayerNameEx(buyer), amount, number_format(price));
  662. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  663. SetPVarInt(buyer, "SQLID_Voucher", GetPlayerSQLId(playerid));
  664. }
  665. else if(strcmp(choice, "restrictedcar", true) == 0)
  666. {
  667. if(amount > PlayerInfo[playerid][pCarVoucher]) return SendClientMessageEx(playerid, COLOR_GRAD1, "You do not have that much vouchers.");
  668. SetPVarInt(buyer, "priceVoucher", price);
  669. SetPVarInt(buyer, "amountVoucher", amount);
  670. SetPVarInt(buyer, "buyingVoucher", 5);
  671. SetPVarInt(buyer, "sellerVoucher", playerid);
  672. SetPVarInt(playerid, "buyerVoucher", buyer);
  673. format(string, sizeof(string), "%s has offered to sell you %d Restricted Car voucher(s) for $%s - Type /accept voucher or /denyvoucher.", GetPlayerNameEx(playerid), amount, number_format(price));
  674. SendClientMessageEx(buyer, COLOR_LIGHTBLUE, string);
  675. format(string, sizeof(string), "You have offered %s %d Restricted Car voucher(s) for $%s, please wait until he accept/decline the offer.", GetPlayerNameEx(buyer), amount, number_format(price));
  676. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  677. SetPVarInt(buyer, "SQLID_Voucher", GetPlayerSQLId(playerid));
  678. }
  679. else if(strcmp(choice, "advert", true) == 0)
  680. {
  681. if(amount > PlayerInfo[playerid][pAdvertVoucher]) return SendClientMessageEx(playerid, COLOR_GRAD1, "You do not have that much vouchers.");
  682. SetPVarInt(buyer, "priceVoucher", price);
  683. SetPVarInt(buyer, "amountVoucher", amount);
  684. SetPVarInt(buyer, "buyingVoucher", 6);
  685. SetPVarInt(buyer, "sellerVoucher", playerid);
  686. SetPVarInt(playerid, "buyerVoucher", buyer);
  687. format(string, sizeof(string), "%s has offered to sell you %d Priority Advertisement voucher(s) for $%s - Type /accept voucher or /denyvoucher.", GetPlayerNameEx(playerid), amount, number_format(price));
  688. SendClientMessageEx(buyer, COLOR_LIGHTBLUE, string);
  689. format(string, sizeof(string), "You have offered %s %d Priority Advertisement voucher(s) for $%s, please wait until he accept/decline the offer.", GetPlayerNameEx(buyer), amount, number_format(price));
  690. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  691. SetPVarInt(buyer, "SQLID_Voucher", GetPlayerSQLId(playerid));
  692. }
  693. else if(strcmp(choice, "7daysvip", true) == 0)
  694. {
  695. if(amount > PlayerInfo[playerid][pSVIPExVoucher]) return SendClientMessageEx(playerid, COLOR_GRAD1, "You do not have that much vouchers.");
  696. SetPVarInt(buyer, "priceVoucher", price);
  697. SetPVarInt(buyer, "amountVoucher", amount);
  698. SetPVarInt(buyer, "buyingVoucher", 7);
  699. SetPVarInt(buyer, "sellerVoucher", playerid);
  700. SetPVarInt(playerid, "buyerVoucher", buyer);
  701. format(string, sizeof(string), "%s has offered to sell you %d 7 Days Silver VIP voucher(s) for $%s - Type /accept voucher or /denyvoucher.", GetPlayerNameEx(playerid), amount, number_format(price));
  702. SendClientMessageEx(buyer, COLOR_LIGHTBLUE, string);
  703. format(string, sizeof(string), "You have offered %s %d 7 Days Silver VIP voucher(s) for $%s, please wait until he accept/decline the offer.", GetPlayerNameEx(buyer), amount, number_format(price));
  704. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  705. SetPVarInt(buyer, "SQLID_Voucher", GetPlayerSQLId(playerid));
  706. }
  707. else if(strcmp(choice, "7daygvip", true) == 0)
  708. {
  709. if(amount > PlayerInfo[playerid][pGVIPExVoucher]) return SendClientMessageEx(playerid, COLOR_GRAD1, "You do not have that much vouchers.");
  710. SetPVarInt(buyer, "priceVoucher", price);
  711. SetPVarInt(buyer, "amountVoucher", amount);
  712. SetPVarInt(buyer, "buyingVoucher", 8);
  713. SetPVarInt(buyer, "sellerVoucher", playerid);
  714. SetPVarInt(playerid, "buyerVoucher", buyer);
  715. format(string, sizeof(string), "%s has offered to sell you %d 7 Days Gold VIP voucher(s) for $%s - Type /accept voucher or /denyvoucher.", GetPlayerNameEx(playerid), amount, number_format(price));
  716. SendClientMessageEx(buyer, COLOR_LIGHTBLUE, string);
  717. format(string, sizeof(string), "You have offered %s %d 7 Days Gold VIP voucher(s) for $%s, please wait until he accept/decline the offer.", GetPlayerNameEx(buyer), amount, number_format(price));
  718. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  719. SetPVarInt(buyer, "SQLID_Voucher", GetPlayerSQLId(playerid));
  720. }
  721. else return SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid choice.");
  722. return 1;
  723. }
  724. CMD:denyvoucher(playerid, params[])
  725. {
  726. if(GetPVarType(playerid, "buyingVoucher"))
  727. {
  728. new string[128];
  729. format(string, sizeof(string), "* %s has declined your voucher offer.", GetPlayerNameEx(playerid));
  730. SendClientMessageEx(GetPVarInt(playerid, "sellerVoucher"), COLOR_LIGHTBLUE, string);
  731. format(string, sizeof(string), "* You have declined %s voucher offer.", GetPlayerNameEx(GetPVarInt(playerid, "sellerVoucher")));
  732. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  733. DeletePVar(playerid, "priceVoucher");
  734. DeletePVar(playerid, "amountVoucher");
  735. DeletePVar(playerid, "buyingVoucher");
  736. DeletePVar(playerid, "sellerVoucher");
  737. }
  738. else return SendClientMessageEx(playerid, COLOR_GRAD1, "No-one has offered you any vouchers.");
  739. return 1;
  740. }
  741. CMD:voucherhelp(playerid, params[])
  742. {
  743. SetPVarInt(playerid, "HelpResultCat0", 10);
  744. Help_ListCat(playerid, DIALOG_HELPCATOTHER1);
  745. return 1;
  746. }
  747. CMD:ovoucherhelp(playerid, params[])
  748. {
  749. SendClientMessageEx(playerid, COLOR_GRAD1, "** Player Commands: /myvouchers /denyvoucher /accept voucher");
  750. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1)
  751. {
  752. SendClientMessageEx(playerid, COLOR_GRAD1, "** Admin Commands: /checkvouchers");
  753. }
  754. return 1;
  755. }
  756. //end of the voucher commands