watchdogs.pwn 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Watchdog 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. CMD:nextwatch(playerid, params[])
  34. {
  35. if(PlayerInfo[playerid][pAdmin] >= 2) return SendClientMessageEx(playerid, COLOR_GRAD1, "Please use /spec to avoid issues.");
  36. if(PlayerInfo[playerid][pWatchdog] >= 1)
  37. {
  38. if(GetPVarInt(playerid, "StartedWatching") == 0) return cmd_startwatch(playerid, params);
  39. if(gettime() >= GetPVarInt(playerid, "NextWatch")) return mysql_tquery(MainPipeline, "SELECT * FROM `nonrppoints` WHERE `active` = '1' ORDER BY `point` DESC", "WatchWatchlist", "i", playerid);
  40. else if(PlayerInfo[playerid][pWatchdog] >= 2) return mysql_tquery(MainPipeline, "SELECT * FROM `nonrppoints` WHERE `active` = '1' ORDER BY `point` DESC", "WatchWatchlist", "i", playerid);
  41. else
  42. {
  43. new string[60];
  44. format(string, sizeof(string), "You can't skip a player yet, you have to wait %d seconds!", GetPVarInt(playerid, "NextWatch")-gettime());
  45. return SendClientMessageEx(playerid, COLOR_GRAD1, string);
  46. }
  47. }
  48. else
  49. {
  50. SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  51. }
  52. return true;
  53. }
  54. CMD:watchspec(playerid, params[])
  55. {
  56. if(PlayerInfo[playerid][pAdmin] >= 2) return SendClientMessageEx(playerid, COLOR_GRAD1, "Please use /spec to avoid issues.");
  57. if(PlayerInfo[playerid][pWatchdog] >= 2)
  58. {
  59. new giveplayerid;
  60. if(GetPVarInt(playerid, "StartedWatching") == 1) return SendClientMessageEx(playerid, COLOR_GRAD1, "WATCHDOG: You already started watching.");
  61. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GRAD1, "USAGE: /watchspec [player]");
  62. if(giveplayerid == playerid) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot spectate yourself!");
  63. if(PlayerInfo[giveplayerid][pWatchlist] == 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "This player is not on the watchlist!");
  64. SpectatePlayer(playerid, giveplayerid);
  65. SendClientMessageEx(playerid, -1, "WATCHDOG: You have started watching.");
  66. SetPVarInt(playerid, "SpectatingWatch", giveplayerid);
  67. SetPVarInt(playerid, "StartedWatching", 1);
  68. }
  69. else
  70. {
  71. SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  72. }
  73. return true;
  74. }
  75. CMD:startwatch(playerid, params[])
  76. {
  77. if(PlayerInfo[playerid][pAdmin] >= 2) return SendClientMessageEx(playerid, COLOR_GRAD1, "Please use /spec to avoid issues.");
  78. if(PlayerInfo[playerid][pWatchdog] >= 1)
  79. {
  80. if(GetPVarInt(playerid, "StartedWatching") == 1) return SendClientMessageEx(playerid, COLOR_GRAD1, "WATCHDOG: You already started watching.");
  81. if(gettime() >= GetPVarInt(playerid, "NextWatch")) return mysql_tquery(MainPipeline, "SELECT * FROM `nonrppoints` WHERE `active` = '1' ORDER BY `point` DESC", "WatchWatchlist", "i", playerid);
  82. else if(PlayerInfo[playerid][pWatchdog] >= 2) return mysql_tquery(MainPipeline, "SELECT * FROM `nonrppoints` WHERE `active` = '1' ORDER BY `point` DESC", "WatchWatchlist", "i", playerid);
  83. else
  84. {
  85. new string[60];
  86. format(string, sizeof(string), "You can't skip a player yet, you have to wait %d seconds!", GetPVarInt(playerid, "NextWatch")-gettime());
  87. return SendClientMessageEx(playerid, COLOR_GRAD1, string);
  88. }
  89. }
  90. else
  91. {
  92. SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  93. }
  94. return true;
  95. }
  96. CMD:stopwatch(playerid, params[])
  97. {
  98. if(PlayerInfo[playerid][pAdmin] >= 2) return SendClientMessageEx(playerid, COLOR_GRAD1, "Please use /spec to avoid issues.");
  99. if(PlayerInfo[playerid][pWatchdog] >= 1)
  100. {
  101. if(GetPVarInt(playerid, "StartedWatching") == 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "WATCHDOG: You aren't spectating anybody.");
  102. SetPVarInt(playerid, "StartedWatching", 0);
  103. if(Spectating[playerid] > 0)
  104. {
  105. SetPVarInt(GetPVarInt(playerid, "SpectatingWatch"), "BeingSpectated", 0);
  106. GettingSpectated[Spectate[playerid]] = INVALID_PLAYER_ID;
  107. Spectating[playerid] = 0;
  108. SpecTime[playerid] = 0;
  109. Spectate[playerid] = INVALID_PLAYER_ID;
  110. SetPVarInt(playerid, "SpecOff", 1 );
  111. TogglePlayerSpectating(playerid, false);
  112. SetCameraBehindPlayer(playerid);
  113. DeletePVar(playerid, "SpectatingWatch");
  114. SendClientMessageEx(playerid, -1, "WATCHDOG: You have stopped watching.");
  115. }
  116. else return SendClientMessageEx(playerid, COLOR_GRAD1, "WATCHDOG: You're not watching anybody.");
  117. }
  118. else
  119. {
  120. SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  121. }
  122. return true;
  123. }
  124. CMD:dmrmute(playerid, params[])
  125. {
  126. if (PlayerInfo[playerid][pAdmin] >= 3)
  127. {
  128. new string[128], giveplayerid;
  129. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /dmrmute [player]");
  130. if(IsPlayerConnected(giveplayerid))
  131. {
  132. if(PlayerInfo[giveplayerid][pDMRMuted] == 0)
  133. {
  134. PlayerInfo[giveplayerid][pDMRMuted] = 1;
  135. format(string, sizeof(string), "AdmCmd: %s has indefinitely blocked %s from submitting DM reports.",GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
  136. ABroadCast(COLOR_LIGHTRED,string,2);
  137. format(string, sizeof(string), "You have been blocked from submitting /dmreports by %s.", GetPlayerNameEx(playerid));
  138. SendClientMessageEx(giveplayerid, COLOR_GRAD2, string);
  139. format(string, sizeof(string), "AdmCmd: %s(%d) was blocked from /dmreport by %s", GetPlayerNameEx(giveplayerid), GetPlayerSQLId(giveplayerid), GetPlayerNameEx(playerid));
  140. Log("logs/mute.log", string);
  141. }
  142. else
  143. {
  144. if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pASM] < 1) return SendClientMessageEx(playerid, COLOR_GREY, "You must be a senior admin to unmute others from submitting DM reports");
  145. PlayerInfo[giveplayerid][pDMRMuted] = 0;
  146. format(string, sizeof(string), "AdmCmd: %s has been re-allowed to submit DM reports by %s",GetPlayerNameEx(giveplayerid),GetPlayerNameEx(playerid));
  147. ABroadCast(COLOR_LIGHTRED,string,2);
  148. format(string, sizeof(string), "You have been re-allowed to submitting /dmreports again by %s.", GetPlayerNameEx(playerid));
  149. SendClientMessageEx(giveplayerid, COLOR_GRAD2, string);
  150. format(string, sizeof(string), "AdmCmd: %s(%d) was unblocked from /dmreport by %s", GetPlayerNameEx(giveplayerid), GetPlayerSQLId(giveplayerid), GetPlayerNameEx(playerid));
  151. Log("logs/mute.log", string);
  152. }
  153. }
  154. }
  155. else
  156. {
  157. SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
  158. }
  159. return 1;
  160. }
  161. CMD:dmreport(playerid, params[])
  162. {
  163. if(PlayerInfo[playerid][pDMRMuted] != 0) return SendClientMessage(playerid, COLOR_GRAD2, "You are blocked from submitting DM reports.");
  164. new giveplayerid;
  165. if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE,"USAGE: /dmreport [playerid]");
  166. if(IsPlayerConnected(giveplayerid))
  167. {
  168. if(playerid == giveplayerid) return SendClientMessage(playerid, COLOR_WHITE, "You can't use this command on yourself!");
  169. if(PlayerInfo[giveplayerid][pAdmin] >= 2 && PlayerInfo[giveplayerid][pTogReports] != 1) return SendClientMessage(playerid, COLOR_WHITE, "You can't use this command on admins!");
  170. if(gettime() - ShotPlayer[giveplayerid][playerid] < 300)
  171. {
  172. SetPVarInt(playerid, "pDMReport", giveplayerid);
  173. ShowPlayerDialogEx(playerid, DMRCONFIRM, DIALOG_STYLE_MSGBOX, "DM Report", "You personally witnessed the reported player death matching within the last 60 seconds. Abuse of this command could result in a temporary ban.", "Confirm", "Cancel");
  174. }
  175. else
  176. {
  177. SendClientMessage(playerid, COLOR_WHITE, "You have not been shot by that person or have already reported them in the last 5 minutes.");
  178. SendClientMessage(playerid, COLOR_WHITE, "As a reminder, abuse of this system could lead to punishment up to a temporary ban.");
  179. }
  180. }
  181. return 1;
  182. }
  183. CMD:dmalert(playerid, params[])
  184. {
  185. if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pAdmin] < 1338) return SendClientMessageEx(playerid, COLOR_GRAD2, "You can't submit reports as an administrator.");
  186. if(PlayerInfo[playerid][pWatchdog] < 1) return SendClientMessageEx(playerid, COLOR_GRAD2, "You're not authorized to use this command!");
  187. if(!GetPVarType(playerid, "SpectatingWatch")) return SendClientMessageEx(playerid, COLOR_GRAD2, "You can only use this command when you are spectating someone!");
  188. if(PlayerInfo[playerid][pRMuted] != 0) return ShowPlayerDialogEx(playerid,7955,DIALOG_STYLE_MSGBOX,"Report blocked","You are blocked from submitting any reports!\n\nTips when reporting:\n- Report what you need, not who you need.\n- Be specific, report exactly what you need.\n- Do not make false reports.\n- Do not flame admins.\n- Report only for in-game items.\n- For shop orders use the /shoporder command","Close", "");
  189. if(GetPVarType(playerid, "HasReport")) return SendClientMessageEx(playerid, COLOR_GREY, "You can only have 1 active report at a time.");
  190. JustReported[playerid]=25;
  191. new giveplayerid = GetPVarInt(playerid, "SpectatingWatch");
  192. new string[128];
  193. format(string, sizeof(string), "{FF0000}(DM Alert) %s (ID %d) is deathmatching.{FFFF91}", GetPlayerNameEx(giveplayerid), giveplayerid);
  194. SendReportToQue(playerid, string, 2, 1);
  195. SetPVarInt(playerid, "AlertedThisPlayer", giveplayerid);
  196. SetPVarInt(playerid, "AlertType", 1);
  197. AlertTime[playerid] = 300;
  198. foreach(new i : Player) if(PlayerInfo[i][pWatchdog] >= 1) SendClientMessageEx(i, COLOR_LIGHTBLUE, string);
  199. SendClientMessageEx(playerid, COLOR_YELLOW, "Your DM report message was sent to the Admins & Watchdogs.");
  200. SetPVarInt(playerid, "WDReport", 1);
  201. format(string, sizeof(string), "Please write a brief report on what you watched %s do.\n * 30 characters min", GetPlayerNameEx(giveplayerid));
  202. return ShowPlayerDialogEx(playerid, DIALOG_WDREPORT, DIALOG_STYLE_INPUT, "Incident Report - DM Alert", string, "Submit", "");
  203. }
  204. CMD:watchlistadd(playerid, params[])
  205. {
  206. if(PlayerInfo[playerid][pWatchdog] >= 4 || PlayerInfo[playerid][pAdmin] >= 1337)
  207. {
  208. new points = 0, days, giveplayerid, string[128];
  209. if(sscanf(params, "ddI(0)", giveplayerid, days, points)) return SendClientMessageEx(playerid, COLOR_GRAD1, "USAGE: /watchlistadd [playerid] [days] [points (optional)]");
  210. if(IsPlayerConnected(giveplayerid))
  211. {
  212. if(PlayerInfo[giveplayerid][pAdmin] >= 2) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot put an administrator on the watchlist!");
  213. if(giveplayerid == playerid) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot put yourself on the watchlist!");
  214. if(days < 1 || days > 365) return SendClientMessageEx(playerid, COLOR_GRAD1, "Please specify an amount of days (1 to 365 Days).");
  215. if(points < 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid Points Specified!");
  216. if(PlayerInfo[giveplayerid][pWatchlist] == 1) return SendClientMessageEx(playerid, COLOR_GRAD1, "This player is already on the watchlist!");
  217. if(points > 0) AddNonRPPoint(giveplayerid, points, gettime()+2592000, "Manually Added", playerid, 1);
  218. PlayerInfo[giveplayerid][pWatchlist] = 1;
  219. PlayerInfo[giveplayerid][pNonRPMeter] += points;
  220. PlayerInfo[giveplayerid][pWatchlistTime] = gettime() + 86400 / days;
  221. format(string, sizeof(string), "You have manually added %s to the watchlist for %d days", GetPlayerNameEx(giveplayerid), days);
  222. SendClientMessageEx(playerid, COLOR_CYAN, string);
  223. format(string, sizeof(string), "%s has added %s(%d) to the watchlist", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), GetPlayerSQLId(giveplayerid));
  224. Log("logs/watchlist.log", string);
  225. }
  226. else return SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified!");
  227. }
  228. else return SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  229. return true;
  230. }
  231. CMD:watchlistremove(playerid, params[])
  232. {
  233. if(PlayerInfo[playerid][pWatchdog] >= 4 || PlayerInfo[playerid][pAdmin] >= 1337)
  234. {
  235. new giveplayerid, string[128];
  236. if(sscanf(params, "d", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GRAD1, "USAGE: /watchlistremove [playerid]");
  237. if(IsPlayerConnected(giveplayerid))
  238. {
  239. if(PlayerInfo[giveplayerid][pAdmin] >= 2) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot perform this command on an administrator!");
  240. if(giveplayerid == playerid) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot perform this command on yourself!");
  241. if(PlayerInfo[giveplayerid][pWatchlist] == 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "This player is not on the watchlist!");
  242. PlayerInfo[giveplayerid][pWatchlist] = 0;
  243. PlayerInfo[giveplayerid][pWatchlistTime] = 0;
  244. format(string, sizeof(string), "You have removed %s from the watchlist.", GetPlayerNameEx(giveplayerid));
  245. SendClientMessageEx(playerid, COLOR_CYAN, string);
  246. format(string, sizeof(string), "%s has removed %s(%d) from the watchlist", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), GetPlayerSQLId(giveplayerid));
  247. Log("logs/watchlist.log", string);
  248. }
  249. else return SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified!");
  250. }
  251. else return SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  252. return true;
  253. }
  254. CMD:restrictaccount(playerid, params[])
  255. {
  256. if(PlayerInfo[playerid][pWatchdog] >= 3 || PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1)
  257. {
  258. new giveplayerid, reason[64], string[128];
  259. if(sscanf(params, "ds[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_GRAD1, "USAGE: /restrictaccount [playerid] [reason]");
  260. if(IsPlayerConnected(giveplayerid))
  261. {
  262. if(PlayerInfo[giveplayerid][pAccountRestricted] == 1) return SendClientMessageEx(playerid, COLOR_GRAD1, "This player account is already restricted!");
  263. if(PlayerInfo[giveplayerid][pAdmin] >= 2) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot restrict an administrator account!");
  264. if(giveplayerid == playerid) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot restrict your own account!");
  265. PlayerInfo[giveplayerid][pAccountRestricted] = 1;
  266. ResetPlayerWeaponsEx(giveplayerid);
  267. format(string, sizeof(string), "You have restricted %s account.", GetPlayerNameEx(giveplayerid));
  268. SendClientMessageEx(playerid, COLOR_CYAN, string);
  269. format(string, sizeof(string), "Your account has been restricted by %s. You will not be able to drive a vehicle, give/take any damage or own any weapons", GetPlayerNameEx(playerid));
  270. SendClientMessageEx(giveplayerid, COLOR_CYAN, string);
  271. SendClientMessageEx(giveplayerid, COLOR_RED, "Note: To lift this restriction, please contact a member of the RP Improvement Team.");
  272. PlayerTextDrawShow(giveplayerid, AccountRestriction[giveplayerid]);
  273. PlayerTextDrawShow(giveplayerid, AccountRestrictionEx[giveplayerid]);
  274. format(string, sizeof(string), "AdmCmd: %s has restricted %s account, reason: %s", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), reason);
  275. ABroadCast(COLOR_LIGHTRED, string, 2);
  276. format(string, sizeof(string), "%s has restricted %s(%d) account, reason: %s", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), GetPlayerSQLId(giveplayerid), reason);
  277. Log("logs/restrictaccount.log", string);
  278. }
  279. else return SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
  280. }
  281. else return SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  282. return true;
  283. }
  284. CMD:unrestrictaccount(playerid, params[])
  285. {
  286. if(PlayerInfo[playerid][pWatchdog] >= 3 || PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1)
  287. {
  288. new giveplayerid, string[128];
  289. if(sscanf(params, "d", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GRAD1, "USAGE: /unrestrictaccount [playerid]");
  290. if(IsPlayerConnected(giveplayerid))
  291. {
  292. if(PlayerInfo[giveplayerid][pAccountRestricted] == 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "This player account is not restricted!");
  293. if(PlayerInfo[giveplayerid][pAdmin] >= 2) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot unrestrict an administrator account!");
  294. if(giveplayerid == playerid) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot unrestrict your own account!");
  295. PlayerInfo[giveplayerid][pAccountRestricted] = 0;
  296. PlayerInfo[giveplayerid][pNonRPMeter] = 0; //fix for bug where non-rp points would remain after being unrestricted.
  297. format(string, sizeof(string), "You have unrestricted %s account.", GetPlayerNameEx(giveplayerid));
  298. SendClientMessageEx(playerid, COLOR_CYAN, string);
  299. format(string, sizeof(string), "Your account has been unrestricted by %s.", GetPlayerNameEx(playerid));
  300. SendClientMessageEx(giveplayerid, COLOR_CYAN, string);
  301. format(string, sizeof(string), "AdmCmd: %s has unrestricted %s account.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
  302. ABroadCast(COLOR_LIGHTRED, string, 2);
  303. PlayerTextDrawHide(giveplayerid, AccountRestriction[giveplayerid]);
  304. PlayerTextDrawHide(giveplayerid, AccountRestrictionEx[giveplayerid]);
  305. format(string, sizeof(string), "%s has unrestricted %s(%d) account", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid), GetPlayerSQLId(giveplayerid));
  306. Log("logs/restrictaccount.log", string);
  307. }
  308. else return SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
  309. }
  310. else return SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  311. return true;
  312. }
  313. CMD:watchdogs(playerid, params[])
  314. {
  315. if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pWatchdog] >= 1)
  316. {
  317. new string[128];
  318. SendClientMessageEx(playerid, COLOR_GRAD1, "Watchdogs Online:");
  319. foreach(new i : Player)
  320. {
  321. if(PlayerInfo[i][pWatchdog] > 0)
  322. {
  323. if(PlayerInfo[i][pWatchdog] == 1) format(string, sizeof(string), "Watchdog %s (ID %i)", GetPlayerNameEx(i), i);
  324. else if(PlayerInfo[i][pWatchdog] == 2) format(string, sizeof(string), "Senior Watchdog %s (ID %i)", GetPlayerNameEx(i), i);
  325. else if(PlayerInfo[i][pWatchdog] == 3) format(string, sizeof(string), "RP Specialist %s (ID %i)", GetPlayerNameEx(i), i);
  326. else if(PlayerInfo[i][pWatchdog] == 4) format(string, sizeof(string), "Director of RP Improvement %s (ID %i)", GetPlayerNameEx(i), i);
  327. if((i == playerid || PlayerInfo[playerid][pWatchdog] >= 3) && PlayerInfo[i][pAdmin] < 2) format(string, sizeof(string), "%s (This Hour: %d | Today: %d)", string, WDReportHourCount[i], WDReportCount[i]);
  328. if(PlayerInfo[playerid][pToggledChats][17]) strcat(string, " (WD Chat Toggled)");
  329. SendClientMessageEx(playerid, COLOR_GRAD2, string);
  330. }
  331. }
  332. }
  333. else return SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  334. return true;
  335. }
  336. CMD:togwd(playerid, params[])
  337. {
  338. if(PlayerInfo[playerid][pAdmin] < 2 && PlayerInfo[playerid][pWatchdog] < 3) return SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  339. if(PlayerInfo[playerid][pToggledChats][17])
  340. {
  341. PlayerInfo[playerid][pToggledChats][17] = 0;
  342. SendClientMessageEx(playerid, COLOR_GRAD1, "** You have enabled the watchdog chat.");
  343. }
  344. else
  345. {
  346. PlayerInfo[playerid][pToggledChats][17] = 1;
  347. SendClientMessageEx(playerid, COLOR_GRAD1, "** You have disabled the watchdog chat.");
  348. }
  349. return 1;
  350. }
  351. CMD:wd(playerid, params[])
  352. {
  353. if(PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pWatchdog] >= 1)
  354. {
  355. if(PlayerInfo[playerid][pWatchdog] < 3) PlayerInfo[playerid][pToggledChats][17] = 0;
  356. if(PlayerInfo[playerid][pToggledChats][17]) return SendClientMessageEx(playerid, COLOR_GREY, "You have watchdog chat disabled - /togwd to enable it.");
  357. if(!isnull(params))
  358. {
  359. szMiscArray[0] = 0;
  360. if(PlayerInfo[playerid][pAdmin] == 2) format(szMiscArray, sizeof(szMiscArray), "- Junior Admin %s: %s", GetPlayerNameEx(playerid), params);
  361. else if(PlayerInfo[playerid][pAdmin] == 3) format(szMiscArray, sizeof(szMiscArray), "- General Admin %s: %s", GetPlayerNameEx(playerid), params);
  362. else if(PlayerInfo[playerid][pAdmin] == 4) format(szMiscArray, sizeof(szMiscArray), "- Senior Admin %s: %s", GetPlayerNameEx(playerid), params);
  363. else if(PlayerInfo[playerid][pAdmin] == 1337) format(szMiscArray, sizeof(szMiscArray), "- Head Admin %s: %s", GetPlayerNameEx(playerid), params);
  364. else if(PlayerInfo[playerid][pAdmin] == 99999) format(szMiscArray, sizeof(szMiscArray), "- Executive Admin %s: %s", GetPlayerNameEx(playerid), params);
  365. else if(PlayerInfo[playerid][pWatchdog] == 1) format(szMiscArray, sizeof(szMiscArray), "** Watchdog %s: %s", GetPlayerNameEx(playerid), params);
  366. else if(PlayerInfo[playerid][pWatchdog] == 2) format(szMiscArray, sizeof(szMiscArray), "** Senior Watchdog %s: %s", GetPlayerNameEx(playerid), params);
  367. else if(PlayerInfo[playerid][pWatchdog] == 3) format(szMiscArray, sizeof(szMiscArray), "** RP Specialist %s: %s", GetPlayerNameEx(playerid), params);
  368. else if(PlayerInfo[playerid][pWatchdog] == 4) format(szMiscArray, sizeof(szMiscArray), "** Director of RP Improvement %s: %s", GetPlayerNameEx(playerid), params);
  369. else format(szMiscArray, sizeof(szMiscArray), "- Undefined Rank %s: %s", GetPlayerNameEx(playerid), params);
  370. foreach(new i : Player)
  371. {
  372. if((PlayerInfo[i][pAdmin] >= 2 || PlayerInfo[i][pWatchdog] >= 1) && PlayerInfo[playerid][pToggledChats][17] == 0)
  373. {
  374. ChatTrafficProcess(i, 0x2267F0FF, szMiscArray, 17);
  375. }
  376. }
  377. }
  378. else return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /wd [watchdog chat]");
  379. }
  380. else return SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  381. return true;
  382. }
  383. CMD:refer(playerid, params[])
  384. {
  385. if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pAdmin] < 1338) return SendClientMessageEx(playerid, COLOR_GRAD2, "You can't submit reports as an administrator.");
  386. new reason[100];
  387. if(PlayerInfo[playerid][pWatchdog] < 1) return SendClientMessageEx(playerid, COLOR_GRAD2, "You're not authorized to use this command!");
  388. if(!GetPVarType(playerid, "SpectatingWatch")) return SendClientMessageEx(playerid, COLOR_GRAD2, "You can only use this command when you are spectating someone!");
  389. if(sscanf(params, "s[100]", reason)) return SendClientMessageEx(playerid, COLOR_GRAD1, "USAGE: /refer [details]");
  390. if(PlayerInfo[playerid][pRMuted] != 0) return ShowPlayerDialogEx(playerid,7955,DIALOG_STYLE_MSGBOX,"Report blocked","You are blocked from submitting any reports!\n\nTips when reporting:\n- Report what you need, not who you need.\n- Be specific, report exactly what you need.\n- Do not make false reports.\n- Do not flame admins.\n- Report only for in-game items.\n- For shop orders use the /shoporder command","Close", "");
  391. if(GetPVarType(playerid, "HasReport")) return SendClientMessageEx(playerid, COLOR_GREY, "You can only have 1 active report at a time.");
  392. JustReported[playerid] = 25;
  393. new giveplayerid = GetPVarInt(playerid, "SpectatingWatch");
  394. new string[128];
  395. format(string, sizeof(string), "{FF0000}(Watchdog Alert) %s (ID %d) | Details: %s{FFFF91}", GetPlayerNameEx(giveplayerid), giveplayerid, reason);
  396. SendReportToQue(playerid, string, 2, 1);
  397. SetPVarInt(giveplayerid, "BeenAlerted", 1);
  398. SetPVarInt(playerid, "AlertedThisPlayer", giveplayerid);
  399. foreach(new i : Player) if(PlayerInfo[i][pWatchdog] >= 1) SendClientMessageEx(i, COLOR_LIGHTBLUE, string);
  400. SendClientMessageEx(playerid, COLOR_YELLOW, "Your Watch Dog Alert was sent to the Admins & Watchdogs.");
  401. SetPVarInt(playerid, "WDReport", 2);
  402. format(string, sizeof(string), "Please write a brief report on what you watched %s do.\n * 30 characters min", GetPlayerNameEx(giveplayerid));
  403. return ShowPlayerDialogEx(playerid, DIALOG_WDREPORT, DIALOG_STYLE_INPUT, "Incident Report - Refer", string, "Submit", "");
  404. }
  405. CMD:wdwhitelist(playerid, params[])
  406. {
  407. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pWatchdog] >= 4 || PlayerInfo[playerid][pASM] >= 1)
  408. {
  409. new string[128], query[256], giveplayer[MAX_PLAYER_NAME], ip[16];
  410. if(sscanf(params, "s[24]s[16]", giveplayer, ip))
  411. {
  412. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /wdwhitelist [watchdog name] [IP]");
  413. return 1;
  414. }
  415. new tmpName[24], tmpIP[16];
  416. mysql_escape_string(giveplayer, tmpName);
  417. mysql_escape_string(ip, tmpIP);
  418. SetPVarString(playerid, "OnWDWhitelist", tmpName);
  419. mysql_format(MainPipeline, query, sizeof(query), "UPDATE `accounts` SET `SecureIP`='%s' WHERE `Username`='%s' AND `Watchdog` <= %d", tmpIP, tmpName, PlayerInfo[playerid][pWatchdog]);
  420. mysql_tquery(MainPipeline, query, "OnWDWhitelist", "i", playerid);
  421. format(string, sizeof(string), "Attempting to whitelist %s on %s's account...", tmpIP, tmpName);
  422. SendClientMessageEx(playerid, COLOR_YELLOW, string);
  423. }
  424. else return SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  425. return true;
  426. }
  427. CMD:watchlist(playerid, params[])
  428. {
  429. if(PlayerInfo[playerid][pWatchdog] >= 1 || PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pSMod] == 1)
  430. {
  431. if(FetchingWatchlist == 1) return SendClientMessageEx(playerid, COLOR_RED, "Please try again later, someone is already fetching the watchlist.");
  432. PublicSQLString = "";
  433. mysql_tquery(MainPipeline, "SELECT * FROM `nonrppoints` WHERE `active` = '1' AND `manual` = '1' ORDER BY `point` DESC", "FetchWatchlist", "i", playerid);
  434. SendClientMessageEx(playerid, COLOR_CYAN, "Fetching the watchlist...");
  435. FetchingWatchlist = 1;
  436. }
  437. else return SendClientMessageEx(playerid, COLOR_GRAD1, "You're not authorized to use this command!");
  438. return true;
  439. }
  440. CMD:makewatchdog(playerid, params[]) {
  441. if(PlayerInfo[playerid][pAdmin] < 1337 && PlayerInfo[playerid][pWatchdog] < 3) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
  442. new ivalue, iTargetID;
  443. if(sscanf(params, "ui", iTargetID, ivalue)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /makewatchdog [player] [level]");
  444. if(!IsPlayerConnected(iTargetID)) return SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid player specified.");
  445. if(PlayerInfo[iTargetID][pHelper] >= 1) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot make Advisors Watchdogs!");
  446. if(PlayerInfo[iTargetID][pWatchdog] == ivalue) return SendClientMessageEx(playerid, COLOR_GREY, "This person already has this watchdog level.");
  447. if(PlayerInfo[playerid][pWatchdog] == 3 && ivalue >= 4) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot promote players to Watchdog Level 4+.");
  448. new szRank[128];
  449. switch(ivalue) {
  450. case 0: format(szRank, sizeof(szRank), "AdmCmd: %s has removed %s's watchdog rank.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID));
  451. case 1: format(szRank, sizeof(szRank), "AdmCmd: %s has made %s a Watchdog.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID));
  452. case 2: format(szRank, sizeof(szRank), "AdmCmd: %s has made %s a Senior Watchdog.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID));
  453. case 3: format(szRank, sizeof(szRank), "AdmCmd: %s has made %s a RP Specialist.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID));
  454. case 4: format(szRank, sizeof(szRank), "AdmCmd: %s has made %s the Director of RP Improvement.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID));
  455. default: format(szRank, sizeof(szRank), "AdmCmd: %s has made %s an undefined level watchdog.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID));
  456. }
  457. ABroadCast(COLOR_LIGHTRED, szRank, 2);
  458. switch(ivalue)
  459. {
  460. case 0: format(szRank, sizeof(szRank), "AdmCmd: %s(%d) has removed %s's(%d) watchdog rank.", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerNameEx(iTargetID), GetPlayerSQLId(iTargetID));
  461. case 1: format(szRank, sizeof(szRank), "AdmCmd: %s(%d) has made %s(%d) a Watchdog.", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerNameEx(iTargetID), GetPlayerSQLId(iTargetID));
  462. case 2: format(szRank, sizeof(szRank), "AdmCmd: %s(%d) has made %s(%d) a Senior Watchdog.", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerNameEx(iTargetID), GetPlayerSQLId(iTargetID));
  463. case 3: format(szRank, sizeof(szRank), "AdmCmd: %s(%d) has made %s(%d) a RP Specialist.", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerNameEx(iTargetID), GetPlayerSQLId(iTargetID));
  464. case 4: format(szRank, sizeof(szRank), "AdmCmd: %s(%d) has made %s(%d) the Director of RP Improvement.", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerNameEx(iTargetID), GetPlayerSQLId(iTargetID));
  465. default: format(szRank, sizeof(szRank), "AdmCmd: %s(%d) has made %s(%d) an undefined level(%d) watchdog.", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerNameEx(iTargetID), GetPlayerSQLId(iTargetID), ivalue);
  466. }
  467. PlayerInfo[iTargetID][pWatchdog] = ivalue;
  468. Log("logs/makewatchdog.log", szRank);
  469. switch(ivalue) {
  470. case 0: format(szRank, sizeof(szRank), "Your watchdog rank has been removed by %s.", GetPlayerNameEx(playerid));
  471. case 1: format(szRank, sizeof(szRank), "You have been made a Watchdog by %s.", GetPlayerNameEx(playerid));
  472. case 2: format(szRank, sizeof(szRank), "You have been made a Senior Watchdog by %s.", GetPlayerNameEx(playerid));
  473. case 3: format(szRank, sizeof(szRank), "You have been made a RP Specialist by %s.", GetPlayerNameEx(playerid));
  474. case 4: format(szRank, sizeof(szRank), "You have been made the Director of RP Improvement by %s.", GetPlayerNameEx(playerid));
  475. default: format(szRank, sizeof(szRank), "You have been made an undefined level watchdog by %s.", GetPlayerNameEx(playerid));
  476. }
  477. SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szRank);
  478. switch(ivalue) {
  479. case 0: format(szRank, sizeof(szRank), "You have removed %s's watchdog rank.", GetPlayerNameEx(iTargetID));
  480. case 1: format(szRank, sizeof(szRank), "You have made %s a Watchdog.", GetPlayerNameEx(iTargetID));
  481. case 2: format(szRank, sizeof(szRank), "You have made %s a Senior Watchdog.", GetPlayerNameEx(iTargetID));
  482. case 3: format(szRank, sizeof(szRank), "You have made %s a RP Specialist.", GetPlayerNameEx(iTargetID));
  483. case 4: format(szRank, sizeof(szRank), "You have made %s the Director of RP Improvement.", GetPlayerNameEx(iTargetID));
  484. default: format(szRank, sizeof(szRank), "You have made %s an undefined level watchdog.", GetPlayerNameEx(iTargetID));
  485. }
  486. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szRank);
  487. return 1;
  488. }