advertisements.pwn 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Advertisements 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 ShowAdMuteFine(playerid)
  35. {
  36. new string[128];
  37. new playername[MAX_PLAYER_NAME];
  38. GetPlayerName(playerid, playername, sizeof(playername));
  39. new totalwealth = PlayerInfo[playerid][pAccount] + GetPlayerCash(playerid);
  40. if(PlayerInfo[playerid][pPhousekey] != INVALID_HOUSE_ID && HouseInfo[PlayerInfo[playerid][pPhousekey]][hOwnerID] == GetPlayerSQLId(playerid)) totalwealth += HouseInfo[PlayerInfo[playerid][pPhousekey]][hSafeMoney];
  41. if(PlayerInfo[playerid][pPhousekey2] != INVALID_HOUSE_ID && HouseInfo[PlayerInfo[playerid][pPhousekey2]][hOwnerID] == GetPlayerSQLId(playerid)) totalwealth += HouseInfo[PlayerInfo[playerid][pPhousekey2]][hSafeMoney];
  42. if(PlayerInfo[playerid][pPhousekey3] != INVALID_HOUSE_ID && HouseInfo[PlayerInfo[playerid][pPhousekey3]][hOwnerID] == GetPlayerSQLId(playerid)) totalwealth += HouseInfo[PlayerInfo[playerid][pPhousekey3]][hSafeMoney];
  43. new fine = 10*totalwealth/100;
  44. if(PlayerInfo[playerid][pADMuteTotal] < 4)
  45. {
  46. format(string,sizeof(string),"Jail for %d Minutes\nCash Fine ($%d)",PlayerInfo[playerid][pADMuteTotal]*15,fine);
  47. }
  48. if(PlayerInfo[playerid][pADMuteTotal] == 4)
  49. {
  50. format(string,sizeof(string),"Prison for 1 Hour");
  51. }
  52. if(PlayerInfo[playerid][pADMuteTotal] == 5)
  53. {
  54. format(string,sizeof(string),"Prison for 1 Hour and 15 Minutes)");
  55. }
  56. if(PlayerInfo[playerid][pADMuteTotal] == 6)
  57. {
  58. format(string,sizeof(string),"Prison for 1 Hour and 30 Minutes");
  59. }
  60. ShowPlayerDialogEx(playerid,ADMUTE,DIALOG_STYLE_LIST,"Advertisements Unmute - Select your Punishment:",string,"Select","Cancel");
  61. }
  62. hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  63. if(arrAntiCheat[playerid][ac_iFlags][AC_DIALOGSPOOFING] > 0) return 1;
  64. if(strfind(inputtext, "%", true) != -1)
  65. {
  66. SendClientMessage(playerid, COLOR_GREY, "Invalid Character, please try again.");
  67. return 1;
  68. }
  69. switch(dialogid)
  70. {
  71. case DIALOG_ADCATEGORY:
  72. {
  73. if(!response) return 1;
  74. szMiscArray[0] = 0;
  75. new szBuffer[32],
  76. arrAdverts[MAX_PLAYERS] = INVALID_PLAYER_ID,
  77. iDialogCount,
  78. iCount,
  79. iBreak,
  80. iRand;
  81. for(new x; x < 50; ++x) ListItemTrackId[playerid][x] = -1;
  82. foreach(new i: Player) if(!isnull(szAdvert[i])) arrAdverts[iCount++] = i;
  83. while(iDialogCount < 50 && iBreak < 500) {
  84. iRand = random(iCount);
  85. if(iCount && arrAdverts[iRand] != INVALID_PLAYER_ID) {
  86. if(AdvertType[arrAdverts[iRand]] == listitem+1)
  87. {
  88. strcpy(szBuffer, szAdvert[arrAdverts[iRand]], sizeof(szBuffer));
  89. if(PlayerInfo[playerid][pAdmin] <= 1) format(szMiscArray, sizeof(szMiscArray), "%s%s... (%i)\r\n", szMiscArray, szBuffer, PlayerInfo[arrAdverts[iRand]][pPnumber]);
  90. else format(szMiscArray, sizeof(szMiscArray), "%s%s... (%s)\r\n", szMiscArray, szBuffer, GetPlayerNameEx(arrAdverts[iRand]));
  91. ListItemTrackId[playerid][iDialogCount++] = arrAdverts[iRand];
  92. arrAdverts[iRand] = INVALID_PLAYER_ID;
  93. }
  94. }
  95. ++iBreak;
  96. }
  97. if(!isnull(szMiscArray)) return ShowPlayerDialogEx(playerid, DIALOG_ADLIST, DIALOG_STYLE_LIST, "Advertisements - List", szMiscArray, "Select", "Return");
  98. ShowPlayerDialogEx(playerid, DIALOG_ADCATEGORY, DIALOG_STYLE_LIST, "Advertisements Categories", "Real Estate\nAutomobile\nBuying\nSelling\nMiscellaneous", "Select", "Cancel");
  99. SendClientMessage(playerid, COLOR_GREY, "No advertisements have been posted.");
  100. }
  101. case DIALOG_ADMAIN: if(response) switch(listitem) {
  102. case 0: ShowPlayerDialogEx(playerid, DIALOG_ADCATEGORY, DIALOG_STYLE_LIST, "Advertisements Categories", "Real Estate\nAutomobile\nBuying\nSelling\nMiscellaneous", "Select", "Cancel");
  103. case 1: ShowPlayerDialogEx(playerid, DIALOG_ADSEARCH, DIALOG_STYLE_INPUT, "Advertisements - Search", "Enter a search phrase.", "Search", "Return");
  104. case 2: {
  105. if(PlayerInfo[playerid][pADMute] == 1) {
  106. SendClientMessageEx(playerid, COLOR_GREY, "You are muted from advertisements.");
  107. }
  108. else if(PlayerInfo[playerid][pPnumber] == 0) {
  109. SendClientMessageEx(playerid, COLOR_GRAD2, "You don't have a cell phone.");
  110. }
  111. else ShowPlayerDialogEx(playerid, DIALOG_ADCATEGORYPLACE, DIALOG_STYLE_LIST, "Select a category", "Real Estate\nAutomobile\nBuying\nSelling\nMiscellaneous", "Select", "Cancel");
  112. }
  113. case 3: {
  114. if(PlayerInfo[playerid][pADMute] == 1) {
  115. SendClientMessageEx(playerid, COLOR_GREY, "You are muted from advertisements.");
  116. }
  117. else if(PlayerInfo[playerid][pPnumber] == 0) {
  118. SendClientMessageEx(playerid, COLOR_GRAD2, "You don't have a cell phone.");
  119. }
  120. else if(gettime() < GetPVarInt(playerid, "adT")) {
  121. ShowMainAdvertMenu(playerid);
  122. return SendClientMessageEx(playerid, COLOR_GREY, "You may only place one priority advertisement every two minutes.");
  123. }
  124. else if(gettime() < iAdverTimer) {
  125. ShowMainAdvertMenu(playerid);
  126. return SendClientMessageEx(playerid, COLOR_GREY, "Only one priority advertisement can be placed every 30 seconds.");
  127. }
  128. else
  129. {
  130. if(PlayerInfo[playerid][pAdvertVoucher] != 0)
  131. {
  132. ShowPlayerDialogEx(playerid, DIALOG_ADVERTVOUCHER, DIALOG_STYLE_MSGBOX, "Priority Advertisement Voucher", "We found a Priority Advertisement Voucher on your account, would you like to use it?\n\n{FF0000}Note: You will lose 1 voucher if you choose yes.{FFFFFF}", "Yes", "Nope");
  133. }
  134. else if(PlayerInfo[playerid][pAdvertVoucher] == 0)
  135. return ShowPlayerDialogEx(playerid, DIALOG_ADCATEGORYPLACEP, DIALOG_STYLE_LIST, "Select a category", "Real Estate\nAutomobile\nBuying\nSelling\nMiscellaneous", "Select", "Cancel");
  136. }
  137. }
  138. case 4: cmd_houselistings(playerid, "");
  139. }
  140. case DIALOG_ADCATEGORYPLACE: {
  141. if(response) switch(listitem) {
  142. case 0: {
  143. AdvertType[playerid] = 1;
  144. ShowPlayerDialogEx(playerid, DIALOG_ADPLACE, DIALOG_STYLE_INPUT, "Advertisements",
  145. "Enter your Real Estate Advertisement! Keep it below 128 characters.", "Submit", "Return");
  146. }
  147. case 1: {
  148. AdvertType[playerid] = 2;
  149. ShowPlayerDialogEx(playerid, DIALOG_ADPLACE, DIALOG_STYLE_INPUT, "Advertisements",
  150. "Enter your Automobile Advertisement! Keep it below 128 characters.", "Submit", "Return");
  151. }
  152. case 2: {
  153. AdvertType[playerid] = 3;
  154. ShowPlayerDialogEx(playerid, DIALOG_ADPLACE, DIALOG_STYLE_INPUT, "Advertisements",
  155. "Enter your Buying Advertisement! Keep it below 128 characters.", "Submit", "Return");
  156. }
  157. case 3: {
  158. AdvertType[playerid] = 4;
  159. ShowPlayerDialogEx(playerid, DIALOG_ADPLACE, DIALOG_STYLE_INPUT, "Advertisements",
  160. "Enter your Selling Advertisement! Keep it below 128 characters.", "Submit", "Return");
  161. }
  162. case 4: {
  163. AdvertType[playerid] = 5;
  164. ShowPlayerDialogEx(playerid, DIALOG_ADPLACE, DIALOG_STYLE_INPUT, "Advertisements",
  165. "Enter your Miscellaneous Advertisement! Keep it below 128 characters.", "Submit", "Return");
  166. }
  167. }
  168. }
  169. case DIALOG_ADCATEGORYPLACEP: {
  170. if(response) switch(listitem) {
  171. case 0: {
  172. AdvertType[playerid] = 1;
  173. ShowPlayerDialogEx(playerid, DIALOG_ADPLACEP, DIALOG_STYLE_INPUT, "Advertisements - Priority Advertisement",
  174. "Enter your Real Estate Priority Advertisement! Keep it below 128 characters.\nAs this is a priority advertisement, it will be broadcasted, and will cost you $150,000.", "Submit", "Return");
  175. }
  176. case 1: {
  177. AdvertType[playerid] = 2;
  178. ShowPlayerDialogEx(playerid, DIALOG_ADPLACEP, DIALOG_STYLE_INPUT, "Advertisements - Priority Advertisement",
  179. "Enter your Automobile Priority Advertisement! Keep it below 128 characters.\nAs this is a priority advertisement, it will be broadcasted, and will cost you $150,000.", "Submit", "Return");
  180. }
  181. case 2: {
  182. AdvertType[playerid] = 3;
  183. ShowPlayerDialogEx(playerid, DIALOG_ADPLACEP, DIALOG_STYLE_INPUT, "Advertisements - Priority Advertisement",
  184. "Enter your Buying Priority Advertisement! Keep it below 128 characters.\nAs this is a priority advertisement, it will be broadcasted, and will cost you $150,000.", "Submit", "Return");
  185. }
  186. case 3: {
  187. AdvertType[playerid] = 4;
  188. ShowPlayerDialogEx(playerid, DIALOG_ADPLACEP, DIALOG_STYLE_INPUT, "Advertisements - Priority Advertisement",
  189. "Enter your Selling Priority Advertisement! Keep it below 128 characters.\nAs this is a priority advertisement, it will be broadcasted, and will cost you $150,000.", "Submit", "Return");
  190. }
  191. case 4: {
  192. AdvertType[playerid] = 5;
  193. ShowPlayerDialogEx(playerid, DIALOG_ADPLACEP, DIALOG_STYLE_INPUT, "Advertisements - Priority Advertisement",
  194. "Enter your Miscellaneous Priority Advertisement! Keep it below 128 characters.\nAs this is a priority advertisement, it will be broadcasted, and will cost you $150,000.", "Submit", "Return");
  195. }
  196. }
  197. }
  198. case DIALOG_ADPLACE: {
  199. if(response) {
  200. new iLength = strlen(inputtext);
  201. if(GetPVarInt(playerid, "RequestingAdP") == 1) return SendClientMessageEx(playerid, COLOR_GRAD1, "You already have a priority advertisement pending.");
  202. if(!(2 <= iLength <= 127)) {
  203. ShowMainAdvertMenu(playerid);
  204. return SendClientMessageEx(playerid, COLOR_GREY, "Your input was too long or too short.");
  205. }
  206. iLength *= 50;
  207. if(GetPlayerCash(playerid) < iLength) {
  208. ShowMainAdvertMenu(playerid);
  209. return SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough cash for this.");
  210. }
  211. /*if(Homes[playerid] > 0 && AdvertType[playerid] == 1 && !PlayerInfo[playerid][pShopNotice])
  212. {
  213. PlayerTextDrawSetString(playerid, MicroNotice[playerid], ShopMsg[6]);
  214. PlayerTextDrawShow(playerid, MicroNotice[playerid]);
  215. SetTimerEx("HidePlayerTextDraw", 10000, false, "ii", playerid, _:MicroNotice[playerid]);
  216. }*/
  217. strcpy(szAdvert[playerid], inputtext, 128);
  218. StripColorEmbedding(szAdvert[playerid]);
  219. GivePlayerCash(playerid, -iLength);
  220. SendClientMessageEx(playerid, COLOR_WHITE, "Congratulations, you have placed your advertisement!");
  221. }
  222. else ShowMainAdvertMenu(playerid);
  223. }
  224. case DIALOG_ADPLACEP: {
  225. if(response) {
  226. if(GetPVarInt(playerid, "RequestingAdP") == 1) return SendClientMessageEx(playerid, COLOR_GRAD1, "You already have a priority advertisement pending.");
  227. if(gettime() < iAdverTimer) {
  228. SendClientMessageEx(playerid, COLOR_GREY, "Only one priority advertisement can be placed every 30 seconds.");
  229. return ShowPlayerDialogEx(playerid, DIALOG_ADPLACEP, DIALOG_STYLE_INPUT, "Advertisements - Priority Advertisement",
  230. "Enter your desired advertisement text! Keep it below 128 characters.\nAs this is a priority advertisement, it will be broadcasted, and will cost you $150,000.", "Submit", "Return");
  231. }
  232. if(!(2 <= strlen(inputtext) <= 79)) {
  233. ShowMainAdvertMenu(playerid);
  234. return SendClientMessageEx(playerid, COLOR_GREY, "Your input was too long or too short.");
  235. }
  236. if(GetPVarInt(playerid, "AdvertVoucher") > 0)
  237. {
  238. }
  239. else if(PlayerInfo[playerid][pFreeAdsLeft] > 0)
  240. {
  241. }
  242. else if(PlayerInfo[playerid][pDonateRank] == 2 && GetPlayerCash(playerid) < 125000) {
  243. ShowMainAdvertMenu(playerid);
  244. return SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough cash for this.");
  245. }
  246. else if(PlayerInfo[playerid][pDonateRank] == 3 && GetPlayerCash(playerid) < 100000) {
  247. ShowMainAdvertMenu(playerid);
  248. return SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough cash for this.");
  249. }
  250. else if(PlayerInfo[playerid][pDonateRank] >= 4 && GetPlayerCash(playerid) < 50000) {
  251. ShowMainAdvertMenu(playerid);
  252. return SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough cash for this.");
  253. }
  254. else if(PlayerInfo[playerid][pDonateRank] <= 1 && GetPlayerCash(playerid) < 150000) {
  255. ShowMainAdvertMenu(playerid);
  256. return SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough cash for this.");
  257. }
  258. SetPVarInt(playerid, "adT", gettime()+120);
  259. strcpy(szAdvert[playerid], inputtext, 128);
  260. StripColorEmbedding(szAdvert[playerid]);
  261. SetPVarInt(playerid, "RequestingAdP", 1);
  262. SetPVarString(playerid, "PriorityAdText", szAdvert[playerid]);
  263. new playername[MAX_PLAYER_NAME];
  264. GetPlayerName(playerid, playername, sizeof(playername));
  265. SendReportToQue(playerid, "Priority Advertisement", 2, 4);
  266. return SendClientMessageEx(playerid, COLOR_WHITE, "You have placed a priority advertisement, please wait until an admin approves/denies your advertisement.");
  267. }
  268. else ShowMainAdvertMenu(playerid);
  269. }
  270. case DIALOG_ADSEARCH: {
  271. if(response) {
  272. if(!(4 <= strlen(inputtext) <= 80)) {
  273. return ShowPlayerDialogEx(playerid, DIALOG_ADSEARCH, DIALOG_STYLE_INPUT, "Advertisements - Search", "Queries must be between 4\n and 80 characters in length.\n\nEnter a search phrase.", "Search", "Return");
  274. }
  275. else for(new x; x < 50; ++x) ListItemTrackId[playerid][x] = -1;
  276. new
  277. szDialog[2256],
  278. szSearch[80],
  279. szBuffer[32],
  280. iCount;
  281. strcat(szSearch, inputtext, sizeof(szSearch)); // strfind is a piece of shit when it comes to non-indexed arrays, maybe this'll help.
  282. foreach(new i: Player)
  283. {
  284. if(!isnull(szAdvert[i])) {
  285. // printf("[ads] [NAME: %s] [ID: %i] [AD: %s] [SEARCH: %s]", GetPlayerNameEx(i), i, szAdvert[i], szSearch);
  286. if(strfind(szAdvert[i], szSearch, true) != -1 && iCount < 50) {
  287. // printf("[ads - MATCH] [NAME: %s] [ID: %i] [AD: %s] [SEARCH: %s] [COUNT: %i] [DIALOG LENGTH: %i] [FINDPOS: %i]", GetPlayerNameEx(i), i, szAdvert[i], szSearch, iCount, strlen(szDialog), strfind(szAdvert[i], szSearch, true));
  288. strcpy(szBuffer, szAdvert[i], sizeof(szBuffer));
  289. if(PlayerInfo[playerid][pAdmin] <= 1) format(szDialog, sizeof(szDialog), "%s%s... (%i)\r\n", szDialog, szBuffer, PlayerInfo[i][pPnumber]);
  290. else format(szDialog, sizeof(szDialog), "%s%s... (%s)\r\n", szDialog, szBuffer, GetPlayerNameEx(i));
  291. ListItemTrackId[playerid][iCount++] = i;
  292. }
  293. }
  294. }
  295. if(!isnull(szDialog)) ShowPlayerDialogEx(playerid, DIALOG_ADSEARCHLIST, DIALOG_STYLE_LIST, "Advertisements - Search Results", szDialog, "Select", "Return");
  296. else ShowPlayerDialogEx(playerid, DIALOG_ADSEARCH, DIALOG_STYLE_INPUT, "Advertisements - Search", "No results found.\n\nEnter a search phrase.", "Search", "Return");
  297. }
  298. else ShowMainAdvertMenu(playerid);
  299. }
  300. case DIALOG_ADSEARCHLIST: if(response) {
  301. new
  302. i = ListItemTrackId[playerid][listitem],
  303. szDialog[164];
  304. if(IsPlayerConnected(i) && !isnull(szAdvert[i])) {
  305. SetPVarInt(playerid, "advertContact", PlayerInfo[i][pPnumber]);
  306. format(szDialog, sizeof(szDialog), "%s\r\nContact: %i", szAdvert[i], PlayerInfo[i][pPnumber]);
  307. ShowPlayerDialogEx(playerid, DIALOG_ADFINAL, DIALOG_STYLE_MSGBOX, "Advertisements - Search Result", szDialog, "Call", "Exit");
  308. }
  309. else SendClientMessage(playerid, COLOR_GREY, "This person has either disconnected or withdrawn their advertisement.");
  310. }
  311. case DIALOG_ADFINAL: {
  312. if(response) {
  313. new params[32];
  314. format(params, sizeof(params), "%d", GetPVarInt(playerid, "advertContact"));
  315. DeletePVar(playerid, "adverContact");
  316. return cmd_call(playerid, params);
  317. }
  318. }
  319. case DIALOG_ADLIST: {
  320. if(response) {
  321. new
  322. i = ListItemTrackId[playerid][listitem],
  323. szDialog[164];
  324. if(IsPlayerConnected(i) && !isnull(szAdvert[i])) {
  325. SetPVarInt(playerid, "advertContact", PlayerInfo[i][pPnumber]);
  326. format(szDialog, sizeof(szDialog), "%s\r\nContact: %i", szAdvert[i], PlayerInfo[i][pPnumber]);
  327. return ShowPlayerDialogEx(playerid, DIALOG_ADFINAL, DIALOG_STYLE_MSGBOX, "Advertisements - Search Result", szDialog, "Call", "Exit");
  328. }
  329. else SendClientMessage(playerid, COLOR_GREY, "This person has either disconnected or withdrawn their advertisement.");
  330. }
  331. else ShowMainAdvertMenu(playerid);
  332. }
  333. case DIALOG_ADVERTVOUCHER:
  334. {
  335. if(response) // Clicked Yes
  336. {
  337. SetPVarInt(playerid, "AdvertVoucher", 1);
  338. ShowPlayerDialogEx(playerid, DIALOG_ADCATEGORYPLACEP, DIALOG_STYLE_LIST, "Select a category", "Real Estate\nAutomobile\nBuying\nSelling\nMiscellaneous", "Select", "Cancel");
  339. }
  340. else // Clicked No
  341. {
  342. ShowPlayerDialogEx(playerid, DIALOG_ADCATEGORYPLACEP, DIALOG_STYLE_LIST, "Select a category", "Real Estate\nAutomobile\nBuying\nSelling\nMiscellaneous", "Select", "Cancel");
  343. }
  344. }
  345. }
  346. return 0;
  347. }
  348. CMD:ads(playerid, params[]) {
  349. return cmd_advertisements(playerid, params);
  350. }
  351. CMD:advertisements(playerid, params[]) {
  352. if(gPlayerLogged{playerid} == 0) {
  353. SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
  354. }
  355. else if(GetPVarType(playerid, "Injured")) {
  356. SendClientMessageEx(playerid, COLOR_GREY, "You can't use advertisements while injured.");
  357. }
  358. else if(PlayerCuffed[playerid] != 0) {
  359. SendClientMessageEx(playerid, COLOR_GREY, "You can't use advertisements right now.");
  360. }
  361. else if(PlayerInfo[playerid][pJailTime] > 0) {
  362. SendClientMessageEx(playerid, COLOR_GREY, "You can't use advertisements while in jail.");
  363. }
  364. else ShowMainAdvertMenu(playerid);
  365. return 1;
  366. }
  367. CMD:adunmute(playerid, params[])
  368. {
  369. if (PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pWatchdog] >= 2)
  370. {
  371. new string[128], giveplayerid;
  372. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /adunmute [player]");
  373. if(IsPlayerConnected(giveplayerid))
  374. {
  375. if(PlayerInfo[giveplayerid][pADMute] == 1)
  376. {
  377. if(PlayerInfo[giveplayerid][pJailTime] != 0)
  378. {
  379. SendClientMessageEx(playerid, COLOR_LIGHTRED, "You cannot offer someone in jail/prison an unmute!");
  380. SendClientMessageEx(giveplayerid, COLOR_LIGHTRED, "Sorry, you cannot be unmuted from /ad while you are in jail/prison.");
  381. return 1;
  382. }
  383. format(string, sizeof(string), "AdmCmd: %s(%d) was unmuted from /ad by %s.", GetPlayerNameEx(giveplayerid), GetPlayerSQLId(giveplayerid), GetPlayerNameEx(playerid));
  384. Log("logs/admin.log", string);
  385. format(string, sizeof(string), "AdmCmd: %s was unmuted from /ad by %s.", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid));
  386. ABroadCast(COLOR_LIGHTRED,string,2);
  387. PlayerInfo[giveplayerid][pADMute] = 0;
  388. PlayerInfo[giveplayerid][pADMuteTotal]--;
  389. }
  390. else
  391. {
  392. SendClientMessageEx(playerid, COLOR_LIGHTRED,"That person is not muted from /newb!");
  393. }
  394. }
  395. }
  396. return 1;
  397. }
  398. CMD:admute(playerid, params[])
  399. {
  400. if (PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pSMod] == 1)
  401. {
  402. new string[128], giveplayerid;
  403. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /admute [player]");
  404. if(IsPlayerConnected(giveplayerid))
  405. {
  406. if(PlayerInfo[giveplayerid][pAdmin] >= 2) return SendClientMessageEx(playerid, COLOR_LIGHTRED, "You can't /admute admins");
  407. if(PlayerInfo[giveplayerid][pADMute] == 0)
  408. {
  409. SetPVarInt(giveplayerid, "UnmuteTime", gettime());
  410. PlayerInfo[giveplayerid][pADMute] = 1;
  411. PlayerInfo[giveplayerid][pADMuteTotal] += 1;
  412. format(string, sizeof(string), "AdmCmd: %s(%d) was muted from placing /ad's by %s(%d).", GetPlayerNameEx(giveplayerid), GetPlayerSQLId(giveplayerid), GetPlayerNameEx(playerid), GetPlayerSQLId(playerid));
  413. Log("logs/admin.log", string);
  414. format(string, sizeof(string), "AdmCmd: %s was muted from placing /ad's by %s.", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid));
  415. ABroadCast(COLOR_LIGHTRED,string,2);
  416. if(PlayerInfo[giveplayerid][pADMuteTotal] > 6)
  417. {
  418. PlayerInfo[giveplayerid][pADMuteTotal] = 0;
  419. CreateBan(playerid, PlayerInfo[giveplayerid][pId], giveplayerid, PlayerInfo[giveplayerid][pIP], "Excessive Ad-mutes", 14);
  420. }
  421. if(PlayerInfo[playerid][pAdmin] == 1)
  422. {
  423. format(string, sizeof(string), "AdmCmd: %s was muted from placing /ad's by Admin.", GetPlayerNameEx(giveplayerid));
  424. SendDutyAdvisorMessage(TEAM_AZTECAS_COLOR, string);
  425. SendClientMessageEx(giveplayerid, COLOR_LIGHTRED, "You were just muted from Advertisements [/ads] by an Admin.");
  426. }
  427. else
  428. {
  429. format(string, sizeof(string), "AdmCmd: %s was muted from placing /ad's by %s.", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid));
  430. SendDutyAdvisorMessage(TEAM_AZTECAS_COLOR, string);
  431. format(string, sizeof(string), "You were just muted from the Advertisements (/ads) by %s.", GetPlayerNameEx(playerid));
  432. SendClientMessageEx(giveplayerid, COLOR_LIGHTRED, string);
  433. }
  434. SendClientMessageEx(giveplayerid, COLOR_LIGHTRED, "Remember, advertisements may only be used for IC purposes and may not be used for any other purpose, unless stated otherwise by an admin.");
  435. SendClientMessageEx(giveplayerid, COLOR_LIGHTRED, "If you wish to be unmuted, you will be fined or jailed. Future abuse could result in increased punishment. If you feel this was in error, contact a senior administrator.");
  436. format(string, sizeof(string), "AdmCmd: %s was just muted from using Advertisements [/ads] due to misuse.", GetPlayerNameEx(giveplayerid));
  437. SendClientMessageToAllEx(COLOR_LIGHTRED, string);
  438. }
  439. else
  440. {
  441. if(PlayerInfo[playerid][pAdmin] >= 2)
  442. {
  443. ShowAdMuteFine(giveplayerid);
  444. format(string, sizeof(string), "You offered %s an unmute from /ads.", GetPlayerNameEx(giveplayerid));
  445. SendClientMessageEx(playerid, COLOR_LIGHTRED, string);
  446. }
  447. else
  448. {
  449. SendClientMessageEx(playerid, COLOR_GRAD1, "That person is currently muted. You are unable to unmute players from advertisements as a Advisor.");
  450. }
  451. }
  452. }
  453. }
  454. else
  455. {
  456. SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
  457. }
  458. return 1;
  459. }
  460. CMD:freeads(playerid, params[])
  461. {
  462. if(PlayerInfo[playerid][pDonateRank] < 4) return SendClientMessageEx(playerid, COLOR_GREY, "You are not a Platinum VIP+");
  463. new string[128], days;
  464. ConvertTime(gettime() - PlayerInfo[playerid][pFreeAdsDay], .ctd=days);
  465. if(days >= 1)
  466. {
  467. PlayerInfo[playerid][pFreeAdsDay] = gettime();
  468. PlayerInfo[playerid][pFreeAdsLeft] = 3;
  469. SendClientMessageEx(playerid, COLOR_YELLOW, "* You still have 3 free ads left for today.");
  470. }
  471. else if(PlayerInfo[playerid][pFreeAdsLeft] > 0)
  472. {
  473. format(string, sizeof(string), "* You still have %d free ads left for today.", PlayerInfo[playerid][pFreeAdsLeft]);
  474. SendClientMessageEx(playerid, COLOR_YELLOW, string);
  475. }
  476. else
  477. {
  478. new datestring[32];
  479. datestring = date(PlayerInfo[playerid][pFreeAdsDay]+86400, 3);
  480. format(string, sizeof(string), "* You have used all your free ads, you will need to wait until %s.", datestring);
  481. SendClientMessageEx(playerid, COLOR_YELLOW, string);
  482. }
  483. return 1;
  484. }
  485. ShowMainAdvertMenu(playerid)
  486. return ShowPlayerDialogEx(playerid, DIALOG_ADMAIN, DIALOG_STYLE_LIST, "Advertisements", "List Advertisements\nSearch Advertisements\nPlace Advertisement\nPlace Priority Advertisement\nHouse Listings", "Select", "Cancel");