HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /***************************************************************************************************
  2. * Copyleft (c)2010 Teascu Dorin & Fysiks
  3. * Plugin Support:
  4. * - http://forums.alliedmods.net/showthread.php?t=90318
  5. * or
  6. * - http://fightersclan.com/forum/f7/amx-ssban-v2-6-%5Bupdate-15-oct-2010%5D-35/
  7. ****************************************************************************************************
  8. * This program is free software; you can redistribute it and/or modify it under the terms
  9. * of the GNU General Public License as published by the Free Software Foundation; either
  10. * version 2 of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  13. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. * See the GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along with this program;
  17. * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  18. * MA 02111-1307 USA
  19. *
  20. * In addition, as a special exception, the author gives permission to link the code of this
  21. * program with the Half-Life Game Engine ("HL Engine") and Modified Game Libraries ("MODs")
  22. * developed by Valve, L.L.C ("Valve"). You must obey the GNU General Public License in all
  23. * respects for all of the code used other than the HL Engine and MODs from Valve.
  24. * If you modify this file, you may extend this exception to your version of the file,
  25. * but you are not obligated to do so. If you do not wish to do so, delete this exception
  26. * statement from your version.
  27. ****************************************************************************************************
  28. * Amx SSBan
  29. * =========
  30. ****************************************************************************************************
  31. * Description
  32. * -----------
  33. * - Take snapshots and ban a player (saved on targets PC) or just take snapshots
  34. ****************************************************************************************************
  35. * Available CVAR's
  36. * ----------------
  37. * amx_ssdelay "1.0" - Delay between snapshots (Def.: "1.0") WARNING has to be .0 as is float
  38. * amx_bandelay "10.0" - Delay before ban is done (Def.: "10.0") WARNING has to be .0 as is float
  39. * amx_ssnumber "3" - Number of snapshots to take (Def.: "3")
  40. * amx_website "" - Unban request site (Def.: "www.yoursite.com")
  41. * amx_msg_type "3" - Info player/admin messages 1 - chat | 2- hud | 3- chat+hud (Def.: "3")
  42. ****************************************************************************************************
  43. * Admin Commands
  44. * --------------
  45. * amx_ss <name or #userid> - Make Snapshots on target !
  46. * amx_ssban <name or #userid> <minutes> [reason] - Ban with snapshots (AMXMODX) !
  47. * If #define AMXBANS is setted to 1 the following console command will be used:
  48. * amx_ssban <minutes> <name or #userid> [reason] - Ban with snapshots (AMXBANS) !
  49. * amx_ssmenu - Displays Snapshot Menu
  50. * amx_ssbanmenu - Displays ban menu
  51. ****************************************************************************************************
  52. * Credits
  53. * -------
  54. * Fysiks - ADDED BAN, SS & SSBan MENU and support for AmxBans v6.x - !!! Thank you !!!
  55. * Alka - stock color chat print
  56. * hackandmore - used his plugin to learn how to use amx_msg_type cvar
  57. * AMXX Dev Team for using their amxmodx ban script
  58. * uTg | bigpapajiggs using his plugin (Admin Screen 2) to learn how to use delay and tasks
  59. * Any other plugins authors that made this type of plugin
  60. ****************************************************************************************************
  61. * Changelog
  62. * ---------
  63. *
  64. * 10.Jul.2010 - v2.6 - [ADDED] support for AmxBans v6.x (by Fysiks)
  65. * [FIXED] lang file by saving it as Unicode without BOM
  66. * 20.Aug.2009 - v2.5 - [ADDED] HUD flashing message to ask reason submission from admin
  67. * 17.Aug.2009 - v2.4 - [FIXED] Amx Mod X banning issue
  68. * 31.Jul.2009 - v2.3 - [ADDED] reason submission for menu bans
  69. * 26.Jul.2009 - v2.2 - [ADDED] menu for taking snapshots - by Fysiks
  70. * [CHANGED] the plugin name from AMXX SSBan w/ Menu in simple AMX SSBan
  71. * 24.Jul.2009 - v2.1 - [REMOVED] amx_ban_type cvar
  72. * [CHANGED] the script for easy usage of bantype (optimized by Fysiks)
  73. * 23.Jul.2009 - v2.0 - [ADDED] ban menu - Al the work provided by Fysiks
  74. * 11.May.2009 - v1.9.5 - [ADDED] tasks controlled by cvar for bans
  75. * [ADDED] cvar amx_bandelay - Delay before ban is done (Def.: 10.0)
  76. * 07.May.2009 - v1.9.1 - [FIXED] the usage of command on immunity admins.
  77. * You can take snapshots of admins with immunity
  78. * 06.May.2009 - v1.9 - [ADDED] to AMXX Snapshot a task to take the snapshots with time delay
  79. * [ADDED] cvar amx_ssdelay - Delay between snapshots (Def.: 1)
  80. * [ADDED] cvar amx_ssnumber - Number of snapshots to take (Def.: 3)
  81. * [ADDED] possibility of taking snapshots on immunity admins
  82. * 06.May.2009 - v1.8.1 beta - [REMOVED] NO ACCESS console message as Fysiks said that
  83. * 'if(!cmd_access...' already does this
  84. * 06.May.2009 - v1.8 beta - [CLEANED] up the plugin (some script arranging)
  85. * [REMOVED] amx_chattag - it was irelevant... left [AMXX] by default as tag
  86. * [ADDED] bans by AMXMODX - THX AMXX Dev Team for ban code
  87. * [ADDED] cvar amx_ban_type - 0- Disabled | 1- AmxModX Ban | 2- AmaBans Ban
  88. * [ADDED] possibility of taking snapshots and banning admins with immunity
  89. * (not working for AMXBANS as is used by server_cmd)
  90. * [ADDED] the console print to inform a player/admin about no acces for command
  91. * 03.May.2009 - v1.7 beta - [ADDED] command amx_ssban to use bans by AMXBANS
  92. * 28.Apr.2009 - v1.6 - [CHANGED] from 'if(get_pcvar_num...' to switch Message type with case
  93. * 18.Apr.2009 - v1.5 - [ADDED] cvar amx_msg_type - 1 - chat | 2- hud | 3- chat+hud (Def: "1")
  94. * [ADDED] hud message for player data (controled by cvar)
  95. * [ADDED] Polish translation
  96. * 17.Apr.2009 - v1.4 - [ADDED] to cache SteamID also in the snapshots - THX xPaw
  97. * 17.Apr.2009 - v1.3 - [CHANGED] cvar to pcvar - THX xPaw for pointing that out !
  98. * 17.Apr.2009 - v1.2 - [ADDED] cvar amx_chattag - Make any tag you like in chat
  99. * 16.Apr.2009 - v1.1 - [ADDED] Multilingual
  100. * 15.Apr.2009 - v1.0:- Initial release
  101. ***************************************************************************************************/
  102.  
  103. // Includes
  104. #include <amxmodx>
  105. #include <amxmisc>
  106. #include <geoip>
  107.  
  108. // Defines
  109. #define VERSION "2.6"
  110.  
  111.  
  112. //********** EDIT HERE if you use AMXBANS ***********//
  113. #define AMXBANS 0 // Allitsd 1 -re az erteket, hogy legyen AmxBans support. (Hasznald az amx_ban parancsot <perc> <userid> [ok])
  114. //***************************************************//
  115.  
  116.  
  117. #define MAX_PLAYERS 33 // Maximum number of players (plus 1)
  118.  
  119. new g_Activity, g_Hostname, g_DelaySS, g_DelayBan, g_SnapShot, g_UnbanURL, g_MsgType, g_SayText
  120. new g_szBanTime[MAX_PLAYERS][8], g_szBanReason[MAX_PLAYERS][32]
  121. new Array:g_bantimes
  122.  
  123. new g_menuPosition[MAX_PLAYERS]
  124. new g_menuPlayers[MAX_PLAYERS][32]
  125. new g_menuPlayersNum[MAX_PLAYERS]
  126. new g_menuOption[MAX_PLAYERS]
  127. new g_menuSettings[MAX_PLAYERS]
  128.  
  129. public plugin_init()
  130. {
  131. /* Register plugin name and author */
  132. register_plugin("AMX SSBan", VERSION, "God@Dorin\Fysiks");
  133.  
  134. /* Register plugin version */
  135. register_cvar("screen_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY);
  136.  
  137. /* Register language file */
  138. register_dictionary("screen_message.txt") // Language file for snapshot messages
  139. register_dictionary("admincmd.txt") // Language file for amxmodx bans
  140.  
  141. /* Register cvars */
  142. g_Activity = get_cvar_pointer("amx_show_activity")
  143. g_Hostname = get_cvar_pointer("hostname")
  144. g_DelaySS = register_cvar("amx_ssdelay", "1.0") // Kesleltetes, a kepernyomentesek kozott (Alapertelmezett ertek.: 1.0)
  145. g_DelayBan = register_cvar("amx_bandelay", "10.0") // Kesleltetes, mielott a kitiltas megtortenne (Alapertelmezett ertek.: 10.0)
  146. g_SnapShot = register_cvar("amx_ssnumber", "3") // Mennyi kepernyomentest csinaljon a felhasznalonak (Alapertelmezett ertek.: 3)
  147. g_UnbanURL = register_cvar("amx_website", "www.weboldalad.com") // Unban kerese az oldalon (Alapertelmezett ertek.: "www.yoursite.com")
  148. g_MsgType = register_cvar("amx_msg_type", "3") // 1- chat | 2- hud | 3- chat+hud (Alapertelmezett ertek.: 3)
  149.  
  150. /* Register console admin commands */
  151. register_concmd("amx_ss", "cmdSS",ADMIN_KICK, "<nev vagy #userid> - kepernyomentes keszitese a felhasznalon !")
  152. #if AMXBANS
  153. if( get_cvar_num("amxbans_use_newbancmd") )
  154. register_concmd("amx_ssban", "cmdBanSS", ADMIN_BAN, "<nev vagy #userid> <perc> [ok] - Kitiltas kepernyomentessel! (AmxBans)")
  155. else
  156. register_concmd("amx_ssban", "cmdBanSS", ADMIN_BAN, "<perc> <nev vagy #userid> [ok] - Kitiltas kepernyomentessel! (AmxBans)")
  157. #else
  158. register_concmd("amx_ssban", "cmdBanSS", ADMIN_BAN, "<nev vagy #userid> <perc> [ok] - Kitiltas kepernyomentessel! (AMX Mod X)")
  159. #endif
  160. register_clcmd("_BanReason", "cmdBanReason")
  161.  
  162. g_SayText = get_user_msgid("SayText")
  163.  
  164. /* Register the menu for banning */
  165. register_clcmd("amx_ssmenu", "cmdSSMenu", ADMIN_KICK, " - ScreenShot Menu Kijelzese")
  166. register_clcmd("amx_ssbanmenu", "cmdBanMenu", ADMIN_BAN, " - ScreenShot Ban Menu Kijelzese")
  167. register_menucmd(register_menuid("SS Menu"), 1023, "actionMenu")
  168.  
  169. /* Set bantimes for the menu */
  170. g_bantimes = ArrayCreate()
  171.  
  172. ArrayPushCell(g_bantimes, 0)
  173. ArrayPushCell(g_bantimes, 5)
  174. ArrayPushCell(g_bantimes, 10)
  175. ArrayPushCell(g_bantimes, 30)
  176. ArrayPushCell(g_bantimes, 60)
  177. ArrayPushCell(g_bantimes, 240)
  178. ArrayPushCell(g_bantimes, 1440)
  179.  
  180. register_srvcmd("amx_ssbantimes", "ssbanmenu_setbantimes")
  181. }
  182.  
  183. public cmdSS(id,level,cid)
  184. {
  185. if(!cmd_access(id, level, cid, 1))
  186. return PLUGIN_HANDLED
  187.  
  188. new target[32]
  189. read_argv(1, target, 31)
  190. new player = cmd_target(id, target, CMDTARGET_OBEY_IMMUNITY)
  191.  
  192. if(!player)
  193. return PLUGIN_HANDLED
  194.  
  195. new name[32], name2[32]
  196. get_user_name(id, name, 31)
  197. get_user_name(player, name2, 31)
  198. /* show message in chat to all players by amx_show_activity */
  199. switch( get_pcvar_num(g_Activity) )
  200. {
  201. case 2: client_printc(0,"%L", LANG_PLAYER, "SS_CASE2", name, name2)
  202. case 1: client_printc(0,"%L", LANG_PLAYER, "SS_CASE1", name2)
  203. }
  204.  
  205. new Param[2]
  206. Param[0] = id
  207. Param[1] = player
  208. /* Set the task to take snapshots */
  209. set_task(Float:get_pcvar_float(g_DelaySS), "SS_Task", 0, Param,2, "a", get_pcvar_num(g_SnapShot))
  210. return PLUGIN_HANDLED
  211.  
  212. }
  213.  
  214. public cmdBanSS(id,level,cid)
  215. {
  216. if(!cmd_access(id, level, cid, 3))
  217. return PLUGIN_HANDLED
  218.  
  219. new target[32]
  220.  
  221. #if AMXBANS
  222. if( get_cvar_num("amxbans_use_newbancmd") )
  223. {
  224. read_argv(1, target, 31)
  225. read_argv(2, g_szBanTime[id], 7)
  226. }
  227. else
  228. {
  229. read_argv(1, g_szBanTime[id], 7)
  230. read_argv(2, target, 31)
  231. }
  232. #else
  233. read_argv(1, target, 31)
  234. read_argv(2, g_szBanTime[id], 7)
  235. #endif
  236. read_argv(3, g_szBanReason[id], 63)
  237.  
  238. new player = cmd_target(id, target, CMDTARGET_OBEY_IMMUNITY)
  239.  
  240. if(!player)
  241. return PLUGIN_HANDLED
  242.  
  243. new Param[2]
  244. Param[0] = id
  245. Param[1] = player
  246.  
  247. /* Set tasks to take snapshots and ban target */
  248. set_task(Float:get_pcvar_float(g_DelaySS), "SS_Task", 0, Param,2, "a", get_pcvar_num(g_SnapShot))
  249. set_task(Float:get_pcvar_float(g_DelayBan), "BanSS_Task", 0, Param, 2)
  250.  
  251. return PLUGIN_HANDLED
  252. }
  253.  
  254. public SS_Task(Param[2])
  255. {
  256. new player = Param[1]
  257. new id = Param[0]
  258. new name[32], timer[32], hostname[64], name2[32], ip[32], authid2[32], country[33], site[64]
  259.  
  260. get_user_name(id, name, 31)
  261. get_user_name(player, name2, 31)
  262. get_user_authid(player, authid2, 31)
  263. get_user_ip(player, ip, 31, 1)
  264.  
  265. geoip_country(ip, country)
  266. get_time("%d/%m/%Y - %H:%M:%S", timer, 63)
  267. get_pcvar_string(g_Hostname, hostname, charsmax(hostname))
  268. get_pcvar_string(g_UnbanURL, site, charsmax(site))
  269.  
  270. switch( get_pcvar_num(g_MsgType) )
  271. {
  272. case 1:
  273. {
  274. /* Show screen messages in chat */
  275. client_printc(player,"%L", player, "SS_MSG1", name)
  276. client_printc(player,"%L", player, "SS_MSG2", timer, hostname)
  277. client_printc(player,"%L", player, "SS_MSG3", name2, ip, authid2, country)
  278. client_printc(player,"%L", player, "SS_MSG4", site)
  279. }
  280. case 2:
  281. {
  282. /* Show screen messages in hud */
  283. set_hudmessage(150, 0, 255, -1.0, 0.1, 0, 0.25, 1.0, 0.0, 0.0, 4)
  284. show_hudmessage(player, "%L", player, "SS_MSG_HUD", timer, hostname, name2, ip, authid2, country, site)
  285. }
  286. case 3:
  287. {
  288. /* Show screen messages in chat */
  289. client_printc(player,"%L", player, "SS_MSG1", name)
  290. client_printc(player,"%L", player, "SS_MSG2", timer, hostname)
  291. client_printc(player,"%L", player, "SS_MSG3", name2, ip, authid2, country)
  292. client_printc(player,"%L", player, "SS_MSG4", site)
  293.  
  294. /* Show screen messages in hud */
  295. set_hudmessage(150, 0, 255, -1.0, 0.1, 0, 0.25, 1.0, 0.0, 0.0, 4)
  296. show_hudmessage(player, "%L", player, "SS_MSG_HUD", timer, hostname, name2, ip, authid2, country, site)
  297. }
  298. }
  299. /* Take the snapshots ! */
  300. client_cmd(player,"snapshot")
  301. /* Confirm for the admin in console that the command was commited */
  302. console_print(id,"%L", id, "SS_CONSOLE", name2)
  303.  
  304. return PLUGIN_HANDLED
  305. }
  306.  
  307. public BanSS_Task(Param[])
  308. {
  309. new id = Param[0]
  310. new player = Param[1]
  311. new minutes[8], reason[32]
  312. new userid2 = get_user_userid(player)
  313.  
  314. copy(minutes, 7, g_szBanTime[id])
  315. copy(reason, 31, g_szBanReason[id])
  316.  
  317. #if AMXBANS // Ban "player" using AmxBans
  318. if( get_cvar_num("amxbans_use_newbancmd") )
  319. client_cmd(id, "amx_ban #%d %s ^"%s^"", userid2, minutes, reason)
  320. else
  321. client_cmd(id, "amx_ban %s #%d ^"%s^"", minutes, userid2, reason)
  322. #else
  323. // Ban "player" using HL Ban Method
  324.  
  325. new authid[32], name2[32], authid2[32], name[32]
  326.  
  327. get_user_authid(player, authid2, 31)
  328. get_user_authid(id, authid, 31)
  329. get_user_name(player, name2, 31)
  330. get_user_name(id, name, 31)
  331.  
  332. log_amx("Kitiltas: ^"%s<%d><%s><>^" Kitiltas es kirugas ^"%s<%d><%s><>^" (perc ^"%s^") (ok ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, minutes, reason)
  333.  
  334. new temp[64], banned[16], nNum = str_to_num(minutes)
  335. if(nNum)
  336. {
  337. formatex(temp, 63, "%L", player, "FOR_MIN", minutes)
  338. }
  339. else
  340. {
  341. formatex(temp, 63, "%L", player, "VEGLEGES")
  342. }
  343.  
  344. formatex(banned, 15, "%L", player, "KITILTVA")
  345.  
  346. if (reason[0])
  347. server_cmd("kick #%d ^"%s (%s %s)^"", userid2, reason, banned, temp)
  348. else
  349. server_cmd("kick #%d ^"%s %s^"", userid2, banned, temp)
  350.  
  351. server_cmd("banid %s %s", minutes, authid2)
  352. server_cmd("writeid")
  353.  
  354. // Display the message to all clients
  355. new msg[256]
  356. new len
  357. new maxpl = get_maxplayers()
  358. for(new i = 1; i <= maxpl; i++)
  359. {
  360. if(is_user_connected(i) && !is_user_bot(i))
  361. {
  362. len = formatex(msg, charsmax(msg), "%L", i, "BAN")
  363. len += formatex(msg[len], charsmax(msg) - len, " %s ", name2)
  364. if(nNum)
  365. {
  366. len += formatex(msg[len], charsmax(msg) - len, "%L", i, "FOR_MIN", minutes)
  367. }
  368. else
  369. {
  370. len += formatex(msg[len], charsmax(msg) - len, "%L", i, "VEGLEGES")
  371. }
  372. if(strlen(reason) > 0)
  373. {
  374. formatex(msg[len], charsmax(msg) - len, " (%L: %s)", i, "OKA", reason)
  375. }
  376. show_activity_id(i, id, name, msg)
  377. }
  378. }
  379. console_print(id, "[AMXX] %L", id, "CLIENT_BANNED", name2)
  380. #endif
  381. return PLUGIN_HANDLED
  382. }
  383.  
  384. public cmdBanMenu(id, level, cid)
  385. {
  386. if (!cmd_access(id, level, cid, 1))
  387. return PLUGIN_HANDLED
  388.  
  389. g_menuOption[id] = 0
  390.  
  391. if (ArraySize(g_bantimes) > 0)
  392. {
  393. g_menuSettings[id] = ArrayGetCell(g_bantimes, g_menuOption[id])
  394. }
  395. else
  396. {
  397. // should never happen, but failsafe
  398. g_menuSettings[id] = 0
  399. }
  400. displayMenu(id, g_menuPosition[id] = 0)
  401.  
  402. return PLUGIN_HANDLED
  403. }
  404.  
  405. public cmdSSMenu(id, level, cid)
  406. {
  407. if (!cmd_access(id, level, cid, 1))
  408. return PLUGIN_HANDLED
  409.  
  410. g_menuOption[id] = 0
  411.  
  412. g_menuSettings[id] = -1
  413. displayMenu(id, g_menuPosition[id] = 0)
  414.  
  415. return PLUGIN_HANDLED
  416. }
  417.  
  418. displayMenu(id, pos)
  419. {
  420. if (pos < 0)
  421. return
  422.  
  423. get_players(g_menuPlayers[id], g_menuPlayersNum[id])
  424.  
  425. new menuBody[512]
  426. new b = 0
  427. new i
  428. new name[32]
  429. new start = pos * 7, len
  430.  
  431. if (start >= g_menuPlayersNum[id])
  432. start = pos = g_menuPosition[id] = 0
  433.  
  434. len = format(menuBody, 511, "\y%L\R%d/%d^n\w^n", id, g_menuSettings[id] == -1 ? "SS_MENU" : "SSBAN_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
  435.  
  436. new end = start + 7
  437. new keys = MENU_KEY_0
  438.  
  439. if (end > g_menuPlayersNum[id])
  440. end = g_menuPlayersNum[id]
  441.  
  442. for (new a = start; a < end; ++a)
  443. {
  444. i = g_menuPlayers[id][a]
  445. get_user_name(i, name, 31)
  446.  
  447. if (is_user_bot(i) || (access(i, ADMIN_IMMUNITY) && i != id))
  448. {
  449. ++b
  450.  
  451. len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
  452. } else {
  453. keys |= (1<<b)
  454.  
  455. if (is_user_admin(i))
  456. len += format(menuBody[len], 511-len, "%d. %s \r*^n\w", ++b, name)
  457. else
  458. len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
  459. }
  460. }
  461.  
  462. if(g_menuSettings[id] != -1)
  463. {
  464. if (g_menuSettings[id])
  465. len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id])
  466. else
  467. len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_PERM")
  468. keys |= MENU_KEY_8
  469. }
  470.  
  471. if (end != g_menuPlayersNum[id])
  472. {
  473. format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "BOVEBBEN", id, pos ? "VISSZA" : "KILEPES")
  474. keys |= MENU_KEY_9
  475. }
  476. else
  477. format(menuBody[len], 511-len, "^n0. %L", id, pos ? "VISSZA" : "KILEPES")
  478.  
  479. show_menu(id, keys, menuBody, -1, "SS Menu")
  480. }
  481.  
  482. public actionMenu(id, key)
  483. {
  484. switch (key)
  485. {
  486. case 7:
  487. {
  488. ++g_menuOption[id]
  489. g_menuOption[id] %= ArraySize(g_bantimes)
  490.  
  491. g_menuSettings[id] = ArrayGetCell(g_bantimes, g_menuOption[id])
  492.  
  493. displayMenu(id, g_menuPosition[id])
  494. }
  495. case 8: displayMenu(id, ++g_menuPosition[id])
  496. case 9: displayMenu(id, --g_menuPosition[id])
  497. default:
  498. {
  499. new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
  500.  
  501. new minutes[8]
  502. num_to_str(g_menuSettings[id], minutes, 7)
  503.  
  504. copy(g_szBanTime[id], 7, minutes)
  505. copy(g_szBanReason[id], 31, "_BanReason")
  506.  
  507. new Param[2]
  508. Param[0] = id
  509. Param[1] = player
  510.  
  511. set_task(Float:get_pcvar_float(g_DelaySS), "SS_Task", 0, Param,2, "a", get_pcvar_num(g_SnapShot))
  512. if(g_menuSettings[id] != -1)
  513. {
  514. messagemode_reason(id)
  515. set_task(Float:get_pcvar_float(g_DelayBan), "BanSS_Task", 0, Param, 2)
  516. }
  517.  
  518. // displayMenu(id, g_menuPosition[id]) // Uncomment this line to make menu remain open after banning
  519. }
  520. }
  521.  
  522. return PLUGIN_HANDLED
  523. }
  524.  
  525. messagemode_reason(id)
  526. {
  527. formatex(g_szBanReason[id], charsmax(g_szBanReason[]), "%L", id, "NO_REASON_MENU")
  528.  
  529. new name[32]
  530. get_user_name(id, name, 31)
  531.  
  532. set_hudmessage(255, 0, 0, 0.0, 0.24, 1, 6.0, 12.0)
  533. show_hudmessage(id, "%L", id, "REASON_HUDASK", name)
  534.  
  535. client_cmd(id, "messagemode _BanReason")
  536. }
  537.  
  538. public cmdBanReason(id)
  539. {
  540. // Client has submitted reason.
  541. new szArg[sizeof(g_szBanReason[])]
  542. read_args(szArg, charsmax(szArg))
  543. remove_quotes(szArg)
  544.  
  545. if(szArg[0])
  546. {
  547. formatex(g_szBanReason[id], charsmax(g_szBanReason[]), szArg)
  548. }
  549. return PLUGIN_HANDLED
  550. }
  551.  
  552. public ssbanmenu_setbantimes()
  553. {
  554. new buff[32]
  555. new args = read_argc()
  556.  
  557. if (args <= 1)
  558. {
  559. server_print("Hasznalat: amx_ssbantimes <ido1> [ido2] [ido3] ...")
  560. server_print(" Ido helyere irj 0 -t, hogy veglegesen kitiltsd a jatekost.")
  561.  
  562. return
  563. }
  564.  
  565. ArrayClear(g_bantimes)
  566.  
  567. for (new i = 1; i < args; i++)
  568. {
  569. read_argv(i, buff, charsmax(buff))
  570.  
  571. ArrayPushCell(g_bantimes, str_to_num(buff))
  572.  
  573. }
  574.  
  575. }
  576.  
  577. /* Stock colors for chat messages */
  578. stock client_printc(const id, const string[], {Float, Sql, Resul,_}:...) {
  579.  
  580. new msg[191], players[32], count = 1
  581. vformat(msg, sizeof msg - 1, string, 3)
  582.  
  583. replace_all(msg,190,"!g","^4")
  584. replace_all(msg,190,"!y","^1")
  585. replace_all(msg,190,"!t","^3")
  586.  
  587. if(id)
  588. players[0] = id
  589. else
  590. get_players(players,count,"ch")
  591.  
  592. for (new i = 0 ; i < count ; i++)
  593. {
  594. if (is_user_connected(players[i]))
  595. {
  596. message_begin(MSG_ONE_UNRELIABLE, g_SayText,_, players[i])
  597. write_byte(players[i])
  598. write_string(msg)
  599. message_end()
  600. }
  601. }
  602. }
  603. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  604. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1048\\ f0\\ fs16 \n\\ par }
  605. */
  606.