#include <amxmodx>
#include <amxmisc>
#include <cstrike>
new g_menuPosition[33]
new g_menuPlayers[33][32]
new g_menuPlayersNum[33]
new g_menuOption[33]
new g_menuSettings[33]
new g_coloredMenus
public plugin_init()
{
// Регистрируем плагин
register_plugin("BanShotMenu","0.1","X-factor");
register_clcmd("amx_bsmenu", "BanShotMenu", ADMIN_BAN, "- displays banshot menu")
register_menucmd(register_menuid("BanShot Menu"), 1023, "actionBanShotMenu")
g_coloredMenus = colored_menus()
register_dictionary("common.txt")
register_dictionary("admincmd.txt")
register_dictionary("plmenu.txt")
}
public actionBanShotMenu(id, key)
{
switch (key)
{
case 7:
{
/* BEGIN OF CHANGES BY MISTAGEE ADDED A FEW MORE OPTIONS */
++g_menuOption[id]
g_menuOption[id] %= 7
switch (g_menuOption[id])
{
case 0: g_menuSettings[id] = 0
case 1: g_menuSettings[id] = 5
case 2: g_menuSettings[id] = 10
case 3: g_menuSettings[id] = 15
case 4: g_menuSettings[id] = 30
case 5: g_menuSettings[id] = 45
case 6: g_menuSettings[id] = 60
}
displayBanShotMenu(id, g_menuPosition[id])
}
case 8: displayBanShotMenu(id, ++g_menuPosition[id])
case 9: displayBanShotMenu(id, --g_menuPosition[id])
default:
{
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
new name[32], name2[32], authid[32], authid2[32]
get_user_name(player, name2, 31)
get_user_authid(id, authid, 31)
get_user_authid(player, authid2, 31)
get_user_name(id, name, 31)
new userid2 = get_user_userid(player)
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")", name, get_user_userid(id), authid, name2, userid2, authid2, g_menuSettings[id])
switch (get_cvar_num("amx_show_activity"))
{
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_BAN_2", name, name2)
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_BAN_1", name2)
}
server_cmd("amx_banshot #%d %d", userid2, g_menuSettings[id])
server_exec()
displayBanShotMenu(id, g_menuPosition[id])
}
}
return PLUGIN_HANDLED
}
displayBanShotMenu(id, pos)
{
if (pos < 0)
return
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
new menuBody[512]
new b = 0
new i
new name[32]
new start = pos * 7
if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "BANSHOT_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
if (end > g_menuPlayersNum[id])
end = g_menuPlayersNum[id]
for (new a = start; a < end; ++a)
{
i = g_menuPlayers[id][a]
get_user_name(i, name, 31)
new ip2[32]
get_user_ip(i, ip2, 31, 1)
if (is_user_bot(i) || access(i, ADMIN_IMMUNITY))
{
++b
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s - IP:%s^n\w", b, name, ip2)
else
len += format(menuBody[len], 511-len, "#. %s - IP:%s^n", name, ip2)
} else {
keys |= (1<<b)
if (is_user_admin(i))
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s - IP:%s \r*^n\w" : "%d. %s *^n", ++b, name, ip2)
else
len += format(menuBody[len], 511-len, "%d. %s - IP:%s^n", ++b, name, ip2)
}
}
if (g_menuSettings[id])
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id])
else
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_PERM")
if (end != g_menuPlayersNum[id])
{
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "BanShot Menu")
}
public BanShotMenu(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
g_menuOption[id] = 1
g_menuSettings[id] = 5
displayBanShotMenu(id, g_menuPosition[id] = 0)
return PLUGIN_HANDLED
}