chat.pwn 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Chat 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. hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  35. if(arrAntiCheat[playerid][ac_iFlags][AC_DIALOGSPOOFING] > 0) return 1;
  36. switch(dialogid) {
  37. case DIALOG_ADO: {
  38. if(!response) return DeletePVar(playerid, "actionstring");
  39. new iTargetID = ListItemTrackId[playerid][listitem],
  40. szMessage[150];
  41. GetPVarString(playerid, "actionstring", szMessage, sizeof(szMessage));
  42. SetPVarInt(iTargetID, "actionplayer", playerid);
  43. format(szMiscArray, sizeof(szMiscArray), " ** Sent: {C2A2DA}%s attempts to %s", GetPlayerNameEx(playerid), szMessage);
  44. SendClientMessageEx(playerid, COLOR_YELLOW, szMiscArray);
  45. format(szMiscArray, sizeof(szMiscArray), " * > Action request sent to: %s. Awaiting response...", GetPlayerNameEx(iTargetID));
  46. SendClientMessageEx(playerid, COLOR_YELLOW, szMiscArray);
  47. format(szMiscArray, sizeof(szMiscArray), "Sender: %s\n\nAction: %s (( %s ))\n\n\
  48. Select 'Accept' to accept the action.\n\
  49. Select 'Deny' to deny the action. You will need to provide a reason.", GetPlayerNameExt(playerid), szMessage, GetPlayerNameExt(playerid));
  50. ShowPlayerDialogEx(iTargetID, DIALOG_ADO2, DIALOG_STYLE_MSGBOX, "Incoming Action Request", szMiscArray, "Accept", "Deny");
  51. }
  52. case DIALOG_ADO2: {
  53. if(!response) {
  54. return ShowPlayerDialogEx(playerid, DIALOG_ADO3, DIALOG_STYLE_INPUT, "Action Denied", "Please provide a reason for denying the action request", "Submit", "Cancel");
  55. }
  56. new iActionID = GetPVarInt(playerid, "actionplayer");
  57. GetPVarString(iActionID, "actionstring", szMiscArray, sizeof(szMiscArray));
  58. format(szMiscArray, sizeof(szMiscArray), "* %s (( %s ))", szMiscArray, GetPlayerNameExt(iActionID));
  59. ProxDetectorWrap(playerid, szMiscArray, 92, 30.0, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  60. DeletePVar(iActionID, "actionstring");
  61. DeletePVar(playerid, "actionplayer");
  62. }
  63. case DIALOG_ADO3: {
  64. new iActionID = GetPVarInt(playerid, "actionplayer");
  65. format(szMiscArray, sizeof(szMiscArray), " * %s denied the action.", GetPlayerNameExt(iActionID));
  66. SendClientMessage(iActionID, COLOR_PURPLE, szMiscArray);
  67. format(szMiscArray, sizeof(szMiscArray), " * Reason: %s.", inputtext);
  68. SendClientMessage(iActionID, COLOR_YELLOW, szMiscArray);
  69. SendClientMessage(playerid, COLOR_PURPLE, "You denied the action.");
  70. format(szMiscArray, sizeof(szMiscArray), " * Reason: %s.", inputtext);
  71. SendClientMessage(playerid, COLOR_YELLOW, szMiscArray);
  72. DeletePVar(iActionID, "actionstring");
  73. DeletePVar(playerid, "actionplayer");
  74. }
  75. }
  76. return 1;
  77. }
  78. hook OnPlayerConnect(playerid) {
  79. for(new i; i < MAX_CHATSETS; ++i) PlayerInfo[playerid][pToggledChats][i] = 0;
  80. for(new i; i < MAX_CHATSETS; ++i) PlayerInfo[playerid][pChatbox][i] = 0;
  81. DeletePVar(playerid, "actionplayer");
  82. DeletePVar(playerid, "actionstring");
  83. return 1;
  84. }
  85. /*
  86. stock SendClientMessageEx(playerid, color, string[])
  87. {
  88. if(InsideMainMenu{playerid} == 1 || InsideTut{playerid} == 1 || ActiveChatbox[playerid] == 0)
  89. return 0;
  90. else SendClientMessage(playerid, color, string);
  91. return 1;
  92. }
  93. */
  94. // Test with SendClientMessageEx
  95. stock SendClientMessageEx(playerid, color, msg[], va_args<>)
  96. {
  97. new string[128];
  98. if(InsideMainMenu{playerid} == 1 || InsideTut{playerid} == 1 || ActiveChatbox[playerid] == 0)
  99. return 0;
  100. else {
  101. va_format(string, sizeof(string), msg, va_start<3>);
  102. SendClientMessage(playerid, color, string);
  103. }
  104. return 1;
  105. }
  106. stock SendClientMessageToAllEx(color, string[])
  107. {
  108. foreach(new i: Player)
  109. {
  110. if(InsideMainMenu{i} == 1 || InsideTut{i} == 1 || ActiveChatbox[i] == 0) {}
  111. else {
  112. SendClientMessage(i, color, string);
  113. }
  114. }
  115. return 1;
  116. }
  117. /*
  118. CMD:togchatbox2(playerid, params[]) {
  119. if(PlayerInfo[playerid][pToggledChats][19]) {
  120. for(new i; i < sizeof(TD_ChatBox); ++i) PlayerTextDrawShow(playerid, TD_ChatBox[i]);
  121. PlayerInfo[playerid][pToggledChats][19] = 0;
  122. }
  123. else {
  124. for(new i; i < sizeof(TD_ChatBox); ++i) PlayerTextDrawHide(playerid, TD_ChatBox[i]);
  125. PlayerInfo[playerid][pToggledChats][19] = 1;
  126. }
  127. return 1;
  128. }
  129. */
  130. stock SendClientMessageWrap(playerid, color, width, string[])
  131. {
  132. if(strlen(string) > width)
  133. {
  134. new firstline[128], secondline[128];
  135. strmid(firstline, string, 0, 88);
  136. strmid(secondline, string, 88, 128);
  137. format(firstline, sizeof(firstline), "%s...", firstline);
  138. format(secondline, sizeof(secondline), "...%s", secondline);
  139. ChatTrafficProcess(playerid, color, firstline, 3);
  140. ChatTrafficProcess(playerid, color, secondline, 3);
  141. }
  142. else ChatTrafficProcess(playerid, color, string, 3);
  143. }
  144. stock ClearChatbox(playerid)
  145. {
  146. for(new i = 0; i < 50; i++) {
  147. SendClientMessage(playerid, COLOR_WHITE, "");
  148. }
  149. return 1;
  150. }
  151. stock OOCOff(color,string[])
  152. {
  153. foreach(new i: Player)
  154. {
  155. if(!gOoc[i]) {
  156. SendClientMessageEx(i, color, string);
  157. }
  158. }
  159. }
  160. stock RadioBroadCast(playerid, string[])
  161. {
  162. foreach(new i: Player)
  163. {
  164. if(PlayerInfo[i][pRadioFreq] == PlayerInfo[playerid][pRadioFreq] && PlayerInfo[i][pRadio] >= 1 && gRadio{i} != 0)
  165. {
  166. format(szMiscArray, sizeof(szMiscArray), "** Radio (%d kHz) ** %s: %s", PlayerInfo[playerid][pRadioFreq], GetPlayerNameEx(playerid), string);
  167. ChatTrafficProcess(i, PUBLICRADIO_COLOR, szMiscArray, 5);
  168. format(szMiscArray, sizeof(szMiscArray), "(radio) %s", string);
  169. SetPlayerChatBubble(playerid, szMiscArray, COLOR_WHITE, 15.0, 5000);
  170. }
  171. }
  172. }
  173. CMD:togooc(playerid, params[])
  174. {
  175. if (!gOoc[playerid])
  176. {
  177. gOoc[playerid] = 1;
  178. SendClientMessageEx(playerid, COLOR_GRAD2, "You have disabled global OOC chat.");
  179. }
  180. else
  181. {
  182. gOoc[playerid] = 0;
  183. SendClientMessageEx(playerid, COLOR_GRAD2, "You have enabled global OOC chat.");
  184. }
  185. return 1;
  186. }
  187. CMD:me(playerid, params[])
  188. {
  189. if(PlayerInfo[playerid][pJailTime] && strfind(PlayerInfo[playerid][pPrisonReason], "[OOC]", true) != -1) return SendClientMessageEx(playerid, COLOR_GREY, "OOC prisoners are restricted to only speak in /b");
  190. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /me [action]");
  191. new string[255];
  192. format(string, sizeof(string), "{FF8000}* {C2A2DA}%s %s", GetPlayerNameEx(playerid), params);
  193. if(PlayerInfo[playerid][pIsolated] != 0) ProxDetector(5.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  194. else ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  195. return 1;
  196. }
  197. CMD:whisper(playerid, params[]) {
  198. return cmd_w(playerid, params);
  199. }
  200. CMD:w(playerid, params[])
  201. {
  202. if(PlayerInfo[playerid][pJailTime] && strfind(PlayerInfo[playerid][pPrisonReason], "[OOC]", true) != -1) return SendClientMessageEx(playerid, COLOR_GREY, "OOC prisoners are restricted to only speak in /b");
  203. new giveplayerid, whisper[128];
  204. if(gPlayerLogged{playerid} == 0)
  205. {
  206. SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
  207. return 1;
  208. }
  209. if(sscanf(params, "us[128]", giveplayerid, whisper))
  210. {
  211. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: (/w)hisper [player] [text]");
  212. return 1;
  213. }
  214. if(GetPVarType(playerid, "WatchingTV") && PlayerInfo[playerid][pAdmin] < 2)
  215. {
  216. SendClientMessageEx(playerid, COLOR_GRAD2, "You can't do this while watching TV.");
  217. return 1;
  218. }
  219. if (IsPlayerConnected(giveplayerid))
  220. {
  221. if(HidePM[giveplayerid] > 0 && PlayerInfo[playerid][pAdmin] < 2)
  222. {
  223. SendClientMessageEx(playerid, COLOR_GREY, "That person is blocking whispers!");
  224. return 1;
  225. }
  226. new giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[128];
  227. sendername = GetPlayerNameEx(playerid);
  228. giveplayer = GetPlayerNameEx(giveplayerid);
  229. if(giveplayerid == playerid)
  230. {
  231. if(PlayerInfo[playerid][pSex] == 1) format(string, sizeof(string), "* %s mutters something to himself.", GetPlayerNameEx(playerid));
  232. else format(string, sizeof(string), "* %s mutters something to herself.", GetPlayerNameEx(playerid));
  233. return ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  234. }
  235. if(ProxDetectorS(5.0, playerid, giveplayerid) || PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pWatchdog] == 2)
  236. {
  237. foreach(new i: Player)
  238. {
  239. if(GetPVarInt(i, "BigEar") == 6 && (GetPVarInt(i, "BigEarPlayer") == playerid || GetPVarInt(i, "BigEarPlayer") == giveplayerid))
  240. {
  241. format(string, sizeof(string), "(BE)%s(ID %d) whispers to %s(ID %d): %s", GetPlayerNameEx(playerid), playerid, GetPlayerNameEx(giveplayerid), giveplayerid, whisper);
  242. SendClientMessageWrap(i, COLOR_YELLOW, 92, string);
  243. }
  244. }
  245. format(string, sizeof(string), "%s (ID %d) whispers to you: %s", GetPlayerNameEx(playerid), playerid, whisper);
  246. SendClientMessageWrap(giveplayerid, COLOR_YELLOW, 92, string);
  247. format(string, sizeof(string), "You whispered to %s: %s", GetPlayerNameEx(giveplayerid),whisper);
  248. SendClientMessageWrap(playerid, COLOR_YELLOW, 92, string);
  249. return 1;
  250. }
  251. else
  252. {
  253. SendClientMessageEx(playerid, COLOR_GREY, "That person isn't near you.");
  254. }
  255. return 1;
  256. }
  257. else
  258. {
  259. SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
  260. }
  261. return 1;
  262. }
  263. CMD:do(playerid, params[])
  264. {
  265. if(gPlayerLogged{playerid} == 0)
  266. {
  267. SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
  268. return 1;
  269. }
  270. if(PlayerInfo[playerid][pJailTime] && strfind(PlayerInfo[playerid][pPrisonReason], "[OOC]", true) != -1) return SendClientMessageEx(playerid, COLOR_GREY, "OOC prisoners are restricted to only speak in /b");
  271. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /do [action]");
  272. else if(strlen(params) > 120) return SendClientMessageEx(playerid, COLOR_GREY, "The specified message must not be longer than 120 characters in length.");
  273. new
  274. iCount,
  275. iPos,
  276. iChar;
  277. while((iChar = params[iPos++])) {
  278. if(iChar == '@') iCount++;
  279. }
  280. if(iCount >= 5) {
  281. return SendClientMessageEx(playerid, COLOR_GREY, "The specified message must not contain more than 4 '@' symbols.");
  282. }
  283. new string[150];
  284. format(string, sizeof(string), "* %s (( %s ))", params, GetPlayerNameEx(playerid));
  285. if(PlayerInfo[playerid][pIsolated] != 0) ProxDetectorWrap(playerid, string, 92, 5.0, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  286. else ProxDetectorWrap(playerid, string, 92, 30.0, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  287. return 1;
  288. }
  289. CMD:ooc(playerid, params[])
  290. {
  291. if(gPlayerLogged{playerid} == 0)
  292. {
  293. SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
  294. return 1;
  295. }
  296. if ((noooc) && PlayerInfo[playerid][pAdmin] < 2 && EventKernel[EventCreator] != playerid)
  297. {
  298. SendClientMessageEx(playerid, COLOR_GRAD2, " The OOC channel has been disabled by an Admin!");
  299. return 1;
  300. }
  301. if(gOoc[playerid])
  302. {
  303. SendClientMessageEx(playerid, TEAM_CYAN_COLOR, " You have disabled OOC Chat, re-enable with /togooc!");
  304. return 1;
  305. }
  306. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: (/o)oc [ooc chat]");
  307. if(PlayerInfo[playerid][pAdmin] == 1)
  308. {
  309. new string[128];
  310. format(string, sizeof(string), "(( Moderator %s: %s ))", GetPlayerNameEx(playerid), params);
  311. OOCOff(COLOR_OOC,string);
  312. }
  313. else if(PlayerInfo[playerid][pAdmin] >= 2)
  314. {
  315. new string[128];
  316. format(string, sizeof(string), "(( %s %s: %s ))", GetAdminRankName(PlayerInfo[playerid][pAdmin]), GetPlayerNameEx(playerid), params);
  317. OOCOff(COLOR_OOC,string);
  318. }
  319. else if(PlayerInfo[playerid][pHelper] >= 1)
  320. {
  321. new string[128];
  322. format(string, sizeof(string), "(( Advisor %s: %s ))", GetPlayerNameEx(playerid), params);
  323. OOCOff(COLOR_OOC,string);
  324. return 1;
  325. }
  326. else if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pHelper] <= 2)
  327. {
  328. new string[128];
  329. format(string, sizeof(string), "(( %s: %s ))", GetPlayerNameEx(playerid), params);
  330. OOCOff(COLOR_OOC,string);
  331. return 1;
  332. }
  333. return 1;
  334. }
  335. CMD:o(playerid, params[])
  336. {
  337. return SendClientMessageEx(playerid, COLOR_GRAD1, "/o has been renamed to /ooc to prevent typos.");
  338. }
  339. CMD:shout(playerid, params[]) {
  340. return cmd_s(playerid, params);
  341. }
  342. CMD:s(playerid, params[])
  343. {
  344. if(PlayerInfo[playerid][pJailTime] && strfind(PlayerInfo[playerid][pPrisonReason], "[OOC]", true) != -1) return SendClientMessageEx(playerid, COLOR_GREY, "OOC prisoners are restricted to only speak in /b");
  345. if(gPlayerLogged{playerid} == 0)
  346. {
  347. SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
  348. return 1;
  349. }
  350. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: (/s)hout [shout chat]");
  351. new string[128];
  352. format(string, sizeof(string), "(shouts) %s!", params);
  353. SetPlayerChatBubble(playerid,string,COLOR_WHITE,60.0,5000);
  354. format(string, sizeof(string), "%s shouts: %s!", GetPlayerNameEx(playerid), params);
  355. if(PlayerInfo[playerid][pIsolated] != 0) ProxDetector(5.0, playerid, string,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_FADE1,COLOR_FADE2, 1); // addition for prison system
  356. else ProxDetector(30.0, playerid, string,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_FADE1,COLOR_FADE2, 1);
  357. return 1;
  358. }
  359. CMD:low(playerid, params[]) {
  360. return cmd_l(playerid, params);
  361. }
  362. CMD:l(playerid, params[])
  363. {
  364. if(gPlayerLogged{playerid} == 0)
  365. {
  366. SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
  367. return 1;
  368. }
  369. if(PlayerInfo[playerid][pJailTime] && strfind(PlayerInfo[playerid][pPrisonReason], "[OOC]", true) != -1) return SendClientMessageEx(playerid, COLOR_GREY, "OOC prisoners are restricted to only speak in /b");
  370. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: (/l)ow [close chat]");
  371. new string[128];
  372. format(string, sizeof(string), "%s says quietly: %s", GetPlayerNameEx(playerid), params);
  373. ProxDetector(5.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5, 1);
  374. format(string, sizeof(string), "(quietly) %s", params);
  375. SetPlayerChatBubble(playerid,string,COLOR_WHITE,5.0,5000);
  376. return 1;
  377. }
  378. CMD:b(playerid, params[])
  379. {
  380. if(gPlayerLogged{playerid} == 0)
  381. {
  382. SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
  383. return 1;
  384. }
  385. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /b [local ooc chat]");
  386. if(GetPVarType(playerid, "WatchingTV")) return SendClientMessage(playerid, COLOR_GRAD1, "You can't use this command while watching TV.");
  387. new string[128];
  388. format(string, sizeof(string), "%s: (( %s ))", GetPlayerNameEx(playerid), params);
  389. if(PlayerInfo[playerid][pIsolated] != 0) ProxDetector(5.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
  390. else ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5, 1, 2, 1);
  391. foreach(new i: Player)
  392. {
  393. if(PlayerInfo[i][pAdmin] > 1 && GetPVarInt(i, "BigEar") == 2)
  394. {
  395. new szAntiprivacy[128];
  396. format(szAntiprivacy, sizeof(szAntiprivacy), "(BE) %s: %s", GetPlayerNameEx(playerid), params);
  397. ChatTrafficProcess(i, COLOR_FADE1, szAntiprivacy, 2);
  398. }
  399. }
  400. return 1;
  401. }
  402. CMD:accent(playerid, params[])
  403. {
  404. new accent;
  405. if(sscanf(params, "d", accent))
  406. {
  407. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /accent [accent ID]");
  408. SendClientMessageEx(playerid, COLOR_GRAD2, "Available Accents: Normal [1], British [2], Japanese [3], Asian [4], Scottish [6], Irish [7], Russian [8]");
  409. SendClientMessageEx(playerid, COLOR_GRAD2, "Available Accents: American [9], Spanish [10], Southern [11], Italian [13], Gangsta [14], Australian [15], Arabic [16]");
  410. SendClientMessageEx(playerid, COLOR_GRAD2, "Available Accents: Balkan [17], Canadian [18], Jamaican [19], Israeli [20], Dutch [21], Brazilian [22], German [23], Turkish [24]");
  411. SendClientMessageEx(playerid, COLOR_GRAD2, "Available Accents: Kiwi [25], French [26], Korean [27], Thai [28], Swedish [29], Danish [30], Norwegian [31]");
  412. return 1;
  413. }
  414. switch(accent)
  415. {
  416. case 1:
  417. {
  418. PlayerInfo[playerid][pAccent] = 1;
  419. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Normal accent, use /accent to change it." );
  420. }
  421. case 2:
  422. {
  423. PlayerInfo[playerid][pAccent] = 2;
  424. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the British accent, use /accent to change it." );
  425. }
  426. case 3:
  427. {
  428. PlayerInfo[playerid][pAccent] = 3;
  429. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Japanese accent, use /accent to change it." );
  430. }
  431. case 4:
  432. {
  433. PlayerInfo[playerid][pAccent] = 4;
  434. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Chinese accent, use /accent to change it." );
  435. }
  436. case 5:
  437. {
  438. PlayerInfo[playerid][pAccent] = 5;
  439. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Korean accent, use /accent to change it." );
  440. }
  441. case 6:
  442. {
  443. PlayerInfo[playerid][pAccent] = 6;
  444. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Scottish accent, use /accent to change it." );
  445. }
  446. case 7:
  447. {
  448. PlayerInfo[playerid][pAccent] = 7;
  449. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Irish accent, use /accent to change it." );
  450. }
  451. case 8:
  452. {
  453. PlayerInfo[playerid][pAccent] = 8;
  454. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Russian accent, use /accent to change it." );
  455. }
  456. case 9:
  457. {
  458. PlayerInfo[playerid][pAccent] = 9;
  459. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the American accent, use /accent to change it." );
  460. }
  461. case 10:
  462. {
  463. PlayerInfo[playerid][pAccent] = 10;
  464. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Spanish accent, use /accent to change it." );
  465. }
  466. case 11:
  467. {
  468. PlayerInfo[playerid][pAccent] = 11;
  469. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Texan accent, use /accent to change it." );
  470. }
  471. case 12:
  472. {
  473. PlayerInfo[playerid][pAccent] = 12;
  474. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Cuban accent, use /accent to change it." );
  475. }
  476. case 13:
  477. {
  478. PlayerInfo[playerid][pAccent] = 13;
  479. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Italian accent, use /accent to change it." );
  480. }
  481. case 14:
  482. {
  483. PlayerInfo[playerid][pAccent] = 14;
  484. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Gangsta accent, use /accent to change it." );
  485. }
  486. case 15:
  487. {
  488. PlayerInfo[playerid][pAccent] = 15;
  489. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Australian accent, use /accent to change it." );
  490. }
  491. case 16:
  492. {
  493. PlayerInfo[playerid][pAccent] = 16;
  494. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Arabic accent, use /accent to change it." );
  495. }
  496. case 17:
  497. {
  498. PlayerInfo[playerid][pAccent] = 17;
  499. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Balkan accent, use /accent to change it." );
  500. }
  501. case 18:
  502. {
  503. PlayerInfo[playerid][pAccent] = 18;
  504. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Canadian accent, use /accent to change it." );
  505. }
  506. case 19:
  507. {
  508. PlayerInfo[playerid][pAccent] = 19;
  509. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Jamaican accent, use /accent to change it." );
  510. }
  511. case 20:
  512. {
  513. PlayerInfo[playerid][pAccent] = 20;
  514. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Israeli accent, use /accent to change it." );
  515. }
  516. case 21:
  517. {
  518. PlayerInfo[playerid][pAccent] = 21;
  519. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Dutch accent, use /accent to change it." );
  520. }
  521. case 22:
  522. {
  523. PlayerInfo[playerid][pAccent] = 22;
  524. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Brazilian accent, use /accent to change it." );
  525. }
  526. case 23:
  527. {
  528. PlayerInfo[playerid][pAccent] = 23;
  529. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the German accent, use /accent to change it." );
  530. }
  531. case 24:
  532. {
  533. PlayerInfo[playerid][pAccent] = 24;
  534. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Turkish accent, use /accent to change it." );
  535. }
  536. case 25:
  537. {
  538. PlayerInfo[playerid][pAccent] = 25;
  539. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Kiwi accent, use /accent to change it." );
  540. }
  541. case 26:
  542. {
  543. PlayerInfo[playerid][pAccent] = 26;
  544. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the French accent, use /accent to change it." );
  545. }
  546. case 27:
  547. {
  548. PlayerInfo[playerid][pAccent] = 27;
  549. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Korean accent, use /accent to change it." );
  550. }
  551. case 28:
  552. {
  553. PlayerInfo[playerid][pAccent] = 28;
  554. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Thai accent, use /accent to change it." );
  555. }
  556. case 29:
  557. {
  558. PlayerInfo[playerid][pAccent] = 29;
  559. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Swedish accent, use /accent to change it." );
  560. }
  561. case 30:
  562. {
  563. PlayerInfo[playerid][pAccent] = 30;
  564. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Danish accent, use /accent to change it." );
  565. }
  566. case 31:
  567. {
  568. PlayerInfo[playerid][pAccent] = 31;
  569. SendClientMessageEx(playerid, COLOR_WHITE, "You will now speak in the Norwegian accent, use /accent to change it." );
  570. }
  571. }
  572. return 1;
  573. }
  574. CMD:pr(playerid, params[])
  575. {
  576. if(PlayerInfo[playerid][pJailTime] && strfind(PlayerInfo[playerid][pPrisonReason], "[OOC]", true) != -1) return SendClientMessageEx(playerid, COLOR_GREY, "OOC prisoners are restricted to only speak in /b");
  577. if(PlayerInfo[playerid][pRadio] == 1)
  578. {
  579. if(isnull(params))
  580. {
  581. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /pr [chat]");
  582. SendClientMessageEx(playerid, COLOR_GRAD2, "HINT: Type /setfreq to set the frequency of your portable radio.");
  583. return 1;
  584. }
  585. if(PlayerInfo[playerid][pRadioFreq] >= 1 || PlayerInfo[playerid][pRadioFreq] <= -1)
  586. {
  587. if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerInfo[playerid][pJailTime] > 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot do this at this time.");
  588. RadioBroadCast(playerid, params);
  589. return 1;
  590. }
  591. else
  592. {
  593. SendClientMessageEx(playerid, COLOR_GRAD2, "The frequency of your radio is set to 0, you can not broadcast over that frequency.");
  594. }
  595. }
  596. else
  597. {
  598. SendClientMessageEx(playerid, COLOR_GRAD2, "You do not have a portable radio!");
  599. }
  600. return 1;
  601. }
  602. CMD:setfreq(playerid, params[])
  603. {
  604. new string[128], frequency;
  605. if(sscanf(params, "d", frequency))
  606. {
  607. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /setfreq [frequency]");
  608. SendClientMessageEx(playerid, COLOR_GRAD2, "HINT: Set the frequency of your radio to 0 if you don't want to hear anything.");
  609. return 1;
  610. }
  611. if(frequency > 9999999 || frequency < -9999999) { SendClientMessageEx(playerid, COLOR_GREY, "Frequency can not be lower than -9999999 or higher than 9999999!"); return 1; }
  612. if (PlayerInfo[playerid][pRadio] == 1)
  613. {
  614. PlayerInfo[playerid][pRadioFreq] = frequency;
  615. format(string, sizeof(string), "You have set the frequency of your portable radio to %d khz.",frequency);
  616. SendClientMessageEx(playerid, COLOR_WHITE, string);
  617. }
  618. else
  619. {
  620. SendClientMessageEx(playerid, COLOR_GRAD2, "You do not have a portable radio!");
  621. }
  622. return 1;
  623. }
  624. ChatTrafficProcess(playerid, color, szString[], chattype) {
  625. if(PlayerInfo[playerid][pToggledChats][chattype] == 0) SendClientMessageEx(playerid, color, szString);
  626. return 1;
  627. /*
  628. if(PlayerInfo[playerid][pChatbox][chattype] > 0 && PlayerInfo[playerid][pToggledChats][19] == 0) { // if Secondary Chatbox is not active, route all chat to normal chatbox.
  629. if(chattype == 1) return SendClientMessageEx(playerid, color, szString); // temp bug fix for /news.
  630. if(chattype == 16) return SendClientMessageEx(playerid, color, szString); // temp bug fix for /staff.
  631. ChatBoxProcess(playerid, color, szString);
  632. }
  633. else SendClientMessageEx(playerid, color, szString);
  634. return 1;
  635. */
  636. }
  637. ProxChatBubble(playerid, szString[]) {
  638. SetPlayerChatBubble(playerid, szString, COLOR_PURPLE, 15.0, 5000);
  639. //format(szString, 128, "{FF8000}> {C2A2DA}%s", szString);
  640. SendClientMessageEx(playerid, COLOR_PURPLE, szString);
  641. }
  642. /*
  643. new MessageStr[MAX_PLAYERS][11][128],
  644. MessageColor[MAX_PLAYERS][11];
  645. ChatBoxProcess(playerid, hColor, szText[]) {
  646. if(PlayerInfo[playerid][pToggledChats][19] == 1) return 1;
  647. new iSize = sizeof(TD_ChatBox) - 1;
  648. for(new line = 1; line < sizeof(TD_ChatBox); line++)
  649. {
  650. PlayerTextDrawHide(playerid, TD_ChatBox[line]);
  651. if(line < iSize)
  652. {
  653. MessageStr[playerid][line] = MessageStr[playerid][line+1];
  654. MessageColor[playerid][line] = MessageColor[playerid][line+1];
  655. PlayerTextDrawSetString(playerid, TD_ChatBox[line], MessageStr[playerid][line]);
  656. }
  657. }
  658. format(MessageStr[playerid][iSize], 128, "... %s", szText);
  659. PlayerTextDrawSetString(playerid, TD_ChatBox[9], MessageStr[playerid][iSize]);
  660. MessageColor[playerid][iSize] = hColor;
  661. for(new line = 1; line < sizeof(TD_ChatBox); line++)
  662. {
  663. PlayerTextDrawColor(playerid, TD_ChatBox[line], MessageColor[playerid][line]);
  664. PlayerTextDrawShow(playerid, TD_ChatBox[line]);
  665. }
  666. return 1;
  667. }
  668. */
  669. /*
  670. ChatBoxProcess(playerid, hColor, szText[]) {
  671. if(PlayerInfo[playerid][pToggledChats][19] == 1) return 1;
  672. new PVarID[5];
  673. for(new i = 10; i > 1; --i) {
  674. format(PVarID, sizeof(PVarID), "CB%d", i - 1);
  675. GetPVarString(playerid, PVarID, szMiscArray, sizeof(szMiscArray));
  676. ChatBoxColor[playerid][i] = ChatBoxColor[playerid][i - 1];
  677. if(!isnull(szMiscArray)) PlayerTextDrawColor(playerid, TD_ChatBox[i], ChatBoxColor[playerid][i]);
  678. PlayerTextDrawSetString(playerid, TD_ChatBox[i], szMiscArray);
  679. PlayerTextDrawShow(playerid, TD_ChatBox[i]);
  680. format(PVarID, sizeof(PVarID), "CB%d", i);
  681. SetPVarString(playerid, PVarID, szMiscArray);
  682. }
  683. SetPVarString(playerid, "CB1", szText);
  684. ChatBoxColor[playerid][1] = hColor;
  685. PlayerTextDrawColor(playerid, TD_ChatBox[1], hColor);
  686. PlayerTextDrawSetString(playerid, TD_ChatBox[1], szText);
  687. PlayerTextDrawShow(playerid, TD_ChatBox[1]);
  688. return 1;
  689. }
  690. */
  691. CMD:ame(playerid, params[])
  692. {
  693. if(PlayerInfo[playerid][pJailTime] && strfind(PlayerInfo[playerid][pPrisonReason], "[OOC]", true) != -1) return SendClientMessageEx(playerid, COLOR_GREY, "OOC prisoners are restricted to only speak in /b");
  694. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /ame [action]");
  695. new string[128];
  696. format(string, sizeof(string), "%s %s", GetPlayerNameEx(playerid), params);
  697. SetPlayerChatBubble(playerid, string, COLOR_PURPLE, 15.0, 5000);
  698. format(string, sizeof(string), "{FF8000}> {C2A2DA}%s", params);
  699. SendClientMessageEx(playerid, COLOR_PURPLE, string);
  700. return 1;
  701. }
  702. CMD:lme(playerid, params[])
  703. {
  704. if(PlayerInfo[playerid][pJailTime] && strfind(PlayerInfo[playerid][pPrisonReason], "[OOC]", true) != -1) return SendClientMessageEx(playerid, COLOR_GREY, "OOC prisoners are restricted to only speak in /b");
  705. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /lme [action]");
  706. new string[128];
  707. format(string, sizeof(string), "{FF8000}* {C2A2DA}%s %s", GetPlayerNameEx(playerid), params);
  708. ProxDetectorWrap(playerid, string, 92, 15, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  709. return 1;
  710. }
  711. CMD:ldo(playerid, params[])
  712. {
  713. if(PlayerInfo[playerid][pJailTime] && strfind(PlayerInfo[playerid][pPrisonReason], "[OOC]", true) != -1) return SendClientMessageEx(playerid, COLOR_GREY, "OOC prisoners are restricted to only speak in /b");
  714. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /ldo [action]");
  715. else if(strlen(params) > 120) return SendClientMessageEx(playerid, COLOR_GREY, "The specified message must not be longer than 120 characters in length.");
  716. new
  717. iCount,
  718. iPos,
  719. iChar;
  720. while((iChar = params[iPos++])) if(iChar == '@') iCount++;
  721. if(iCount >= 5) return SendClientMessageEx(playerid, COLOR_GREY, "The specified message must not contain more than 4 '@' symbols.");
  722. new string[150];
  723. format(string, sizeof(string), "* %s (( %s ))", params, GetPlayerNameEx(playerid));
  724. ProxDetectorWrap(playerid, string, 92, 15.0, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  725. return 1;
  726. }
  727. CMD:resetexamine(playerid, params[])
  728. {
  729. if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pASM] < 1) return 1;
  730. new target;
  731. if(sscanf(params, "u", target)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /resetexamine [playerid]");
  732. if(!IsPlayerConnected(target)) return SendClientMessageEx(playerid, COLOR_GREY, "Error: Player is not connected!");
  733. format(PlayerInfo[target][pExamineDesc], 256, "None");
  734. return SendClientMessageEx(playerid, COLOR_GREY, "You have successfully reset their examine description.");
  735. }
  736. CMD:se(playerid, params[]) return cmd_setexamine(playerid, params);
  737. CMD:setexamine(playerid, params[]) return ShowPlayerDialogEx(playerid, DIALOG_SETEXAMINE, DIALOG_STYLE_INPUT, "Examine Description", "Please enter a description of yourself.\nExample: appears to be a white male, 6' 3 ..etc", "Set", "Cancel");
  738. CMD:examine(playerid, params[])
  739. {
  740. new target;
  741. if(sscanf(params, "u", target)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /examine [playerid]");
  742. if(!IsPlayerConnected(target)) return SendClientMessageEx(playerid, COLOR_GREY, "Error: Player is not connected!");
  743. if(!ProxDetectorS(5.0, playerid, target) && PlayerInfo[playerid][pAdmin] < 2) return SendClientMessageEx(playerid, COLOR_GREY, "That person isn't near you.");
  744. if(!strlen(PlayerInfo[target][pExamineDesc]) || !strcmp(PlayerInfo[target][pExamineDesc], "None", true)) return SendClientMessageEx(playerid, COLOR_GREY, "That person doesn't have a description set.");
  745. if(strlen(PlayerInfo[target][pExamineDesc]) > 101)
  746. {
  747. new firstline[128], secondline[128];
  748. strmid(firstline, PlayerInfo[target][pExamineDesc], 0, 101);
  749. strmid(secondline, PlayerInfo[target][pExamineDesc], 101, 128);
  750. format(firstline, sizeof(firstline), "* %s %s", GetPlayerNameEx(target), firstline);
  751. format(secondline, sizeof(secondline), "...%s", secondline);
  752. SendClientMessageEx(playerid, COLOR_PURPLE, firstline);
  753. SendClientMessageEx(playerid, COLOR_PURPLE, secondline);
  754. }
  755. else
  756. {
  757. new string[128];
  758. format(string, sizeof(string), "* %s %s", GetPlayerNameEx(target), PlayerInfo[target][pExamineDesc]);
  759. SendClientMessageEx(playerid, COLOR_PURPLE, string);
  760. }
  761. return 1;
  762. }