Add a new access level flag 'v' for temporary bans (bug 3218, r=arkshine)
Former-commit-id: d09b92cf6c3ffa6ea82b4c4b005056e7875ee80f
This commit is contained in:
parent
da30315556
commit
784f91e441
@ -54,6 +54,11 @@ amx_freq_imessage 180
|
||||
// Default values: 0 5 10 15 30 45 60
|
||||
amx_plmenu_bantimes 0 5 10 15 30 45 60
|
||||
|
||||
// Max temporary ban time (admins with ADMIN_BAN_TEMP access can't ban more than this time)
|
||||
// time in minutes, 60 is 1 hour, 120 is 2 hours, 1440 is 1 day, and 10080 is 1 week
|
||||
// Default value: 4320 aka 3 days
|
||||
amx_tempban_maxtime 4320
|
||||
|
||||
// Slap damage amounts for the main slap menu (amx_slapmenu)
|
||||
// Slay is automatically inserted as the first option.
|
||||
// Default values: 0 1 5
|
||||
|
@ -54,6 +54,11 @@ amx_freq_imessage 180
|
||||
// Default values: 0 5 10 15 30 45 60
|
||||
amx_plmenu_bantimes 0 5 10 15 30 45 60
|
||||
|
||||
// Max temporary ban time (admins with ADMIN_BAN_TEMP access can't ban more than this time)
|
||||
// time in minutes, 60 is 1 hour, 120 is 2 hours, 1440 is 1 day, and 10080 is 1 week
|
||||
// Default value: 4320 aka 3 days
|
||||
amx_tempban_maxtime 4320
|
||||
|
||||
// Slap damage amounts for the main slap menu (amx_slapmenu)
|
||||
// Slay is automaticall inserted as the first option
|
||||
// Default values: 0 1 5
|
||||
|
@ -54,6 +54,11 @@ amx_freq_imessage 180
|
||||
// Default values: 0 5 10 15 30 45 60
|
||||
amx_plmenu_bantimes 0 5 10 15 30 45 60
|
||||
|
||||
// Max temporary ban time (admins with ADMIN_BAN_TEMP access can't ban more than this time)
|
||||
// time in minutes, 60 is 1 hour, 120 is 2 hours, 1440 is 1 day, and 10080 is 1 week
|
||||
// Default value: 4320 aka 3 days
|
||||
amx_tempban_maxtime 4320
|
||||
|
||||
// Slap damage amounts for the main slap menu (amx_slapmenu)
|
||||
// Slay is automatically inserted as the first option.
|
||||
// Default values: 0 1 5
|
||||
|
@ -7,7 +7,7 @@
|
||||
; a - immunity (can't be kicked/baned/slayed/slaped and affected by other commmands)
|
||||
; b - reservation (can join on reserved slots)
|
||||
; c - amx_kick command
|
||||
; d - amx_ban and amx_unban commands
|
||||
; d - amx_ban and amx_unban commands (permanent and temporary bans)
|
||||
; e - amx_slay and amx_slap commands
|
||||
; f - amx_map command
|
||||
; g - amx_cvar command (not all cvars will be available)
|
||||
@ -25,6 +25,7 @@
|
||||
; s - custom level G
|
||||
; t - ns commands (amx_random, amx_readyroom, amx_uncomm, amx_alien, amx_marine)
|
||||
; u - menu access
|
||||
; v - amx_ban and amx_unban commands (temporary bans only, about amx_unban, only self performed ban during map gonna be allowed)
|
||||
; z - user (no admin)
|
||||
|
||||
; Account flags:
|
||||
@ -42,8 +43,8 @@
|
||||
; <name|ip|steamid> <password> <access flags> <account flags>
|
||||
|
||||
; Examples of admin accounts:
|
||||
; "STEAM_0:0:123456" "" "abcdefghijklmnopqrstu" "ce"
|
||||
; "123.45.67.89" "" "abcdefghijklmnopqrstu" "de"
|
||||
; "My Name" "my_password" "abcdefghijklmnopqrstu" "a"
|
||||
; "STEAM_0:0:123456" "" "abcdefghijklmnopqrstuv" "ce"
|
||||
; "123.45.67.89" "" "abcdefghijklmnopqrstuv" "de"
|
||||
; "My Name" "my_password" "abcdefghijklmnopqrstuv" "a"
|
||||
|
||||
"loopback" "" "abcdefghijklmnopqrstu" "de"
|
||||
"loopback" "" "abcdefghijklmnopqrstuv" "de"
|
||||
|
@ -7,7 +7,7 @@
|
||||
; a - immunity (can't be kicked/baned/slayed/slaped and affected by other commmands)
|
||||
; b - reservation (can join on reserved slots)
|
||||
; c - amx_kick command
|
||||
; d - amx_ban and amx_unban commands
|
||||
; d - amx_ban and amx_unban commands (permanent and temporary bans)
|
||||
; e - amx_slay and amx_slap commands
|
||||
; f - amx_map command
|
||||
; g - amx_cvar command (not all cvars will be available)
|
||||
@ -25,6 +25,7 @@
|
||||
; s - custom level G
|
||||
; t - custom level H
|
||||
; u - menu access
|
||||
; v - amx_ban and amx_unban commands (temporary bans only, about amx_unban, only self performed ban during map gonna be allowed)
|
||||
; z - user (no admin)
|
||||
|
||||
; Account flags:
|
||||
@ -45,8 +46,8 @@
|
||||
; <name|ip|steamid> <password> <access flags> <account flags>
|
||||
|
||||
; Examples of admin accounts:
|
||||
; "STEAM_0:0:123456" "" "abcdefghijklmnopqrstu" "ce"
|
||||
; "123.45.67.89" "" "abcdefghijklmnopqrstu" "de"
|
||||
; "My Name" "my_password" "abcdefghijklmnopqrstu" "a"
|
||||
; "STEAM_0:0:123456" "" "abcdefghijklmnopqrstuv" "ce"
|
||||
; "123.45.67.89" "" "abcdefghijklmnopqrstuv" "de"
|
||||
; "My Name" "my_password" "abcdefghijklmnopqrstuv" "a"
|
||||
|
||||
"loopback" "" "abcdefghijklmnopqrstu" "de"
|
||||
"loopback" "" "abcdefghijklmnopqrstuv" "de"
|
||||
|
@ -47,6 +47,7 @@ new g_addCvar[] = "amx_cvar add %s"
|
||||
new pausable;
|
||||
new rcon_password;
|
||||
new timelimit;
|
||||
new p_amx_tempban_maxtime;
|
||||
|
||||
// Old connection queue
|
||||
new g_Names[OLD_CONNECTION_QUEUE][32];
|
||||
@ -56,6 +57,8 @@ new g_Access[OLD_CONNECTION_QUEUE];
|
||||
new g_Tracker;
|
||||
new g_Size;
|
||||
|
||||
public Trie:g_tempBans
|
||||
|
||||
stock InsertInfo(id)
|
||||
{
|
||||
|
||||
@ -161,10 +164,10 @@ public plugin_init()
|
||||
|
||||
|
||||
register_concmd("amx_kick", "cmdKick", ADMIN_KICK, "<name or #userid> [reason]")
|
||||
register_concmd("amx_ban", "cmdBan", ADMIN_BAN, "<name or #userid> <minutes> [reason]")
|
||||
register_concmd("amx_banip", "cmdBanIP", ADMIN_BAN, "<name or #userid> <minutes> [reason]")
|
||||
register_concmd("amx_ban", "cmdBan", ADMIN_BAN|ADMIN_BAN_TEMP, "<name or #userid> <minutes> [reason]")
|
||||
register_concmd("amx_banip", "cmdBanIP", ADMIN_BAN|ADMIN_BAN_TEMP, "<name or #userid> <minutes> [reason]")
|
||||
register_concmd("amx_addban", "cmdAddBan", ADMIN_BAN, "<^"authid^" or ip> <minutes> [reason]")
|
||||
register_concmd("amx_unban", "cmdUnban", ADMIN_BAN, "<^"authid^" or ip>")
|
||||
register_concmd("amx_unban", "cmdUnban", ADMIN_BAN|ADMIN_BAN_TEMP, "<^"authid^" or ip>")
|
||||
register_concmd("amx_slay", "cmdSlay", ADMIN_SLAY, "<name or #userid>")
|
||||
register_concmd("amx_slap", "cmdSlap", ADMIN_SLAY, "<name or #userid> [power]")
|
||||
register_concmd("amx_leave", "cmdLeave", ADMIN_KICK, "<tag> [tag] [tag] [tag]")
|
||||
@ -186,7 +189,9 @@ public plugin_init()
|
||||
rcon_password=get_cvar_pointer("rcon_password");
|
||||
pausable=get_cvar_pointer("pausable");
|
||||
timelimit=get_cvar_pointer( "mp_timelimit" );
|
||||
|
||||
p_amx_tempban_maxtime = register_cvar("amx_tempban_maxtime", "4320");
|
||||
|
||||
g_tempBans = TrieCreate();
|
||||
}
|
||||
|
||||
public plugin_cfg()
|
||||
@ -205,6 +210,7 @@ public plugin_cfg()
|
||||
server_cmd(g_addCvar, "amx_sql_pass");
|
||||
server_cmd(g_addCvar, "amx_sql_db");
|
||||
server_cmd(g_addCvar, "amx_sql_type");
|
||||
server_cmd(g_addCvar, "amx_tempban_maxtime");
|
||||
|
||||
}
|
||||
|
||||
@ -257,6 +263,18 @@ public cmdUnban(id, level, cid)
|
||||
new arg[32], authid[32], name[32]
|
||||
|
||||
read_argv(1, arg, charsmax(arg))
|
||||
|
||||
get_user_authid(id, authid, charsmax(authid))
|
||||
|
||||
if( ~get_user_flags(id) & ( ADMIN_BAN | ADMIN_RCON ) )
|
||||
{
|
||||
new storedAdminAuth[32]
|
||||
if( !TrieGetString(g_tempBans, arg, storedAdminAuth, charsmax(storedAdminAuth)) || !equal(storedAdminAuth, authid) )
|
||||
{
|
||||
console_print(id, "%L", id, "NO_ACC_COM"); // may be someone wants to create a new sentence and to translate it in all languages ?
|
||||
return PLUGIN_HANDLED;
|
||||
}
|
||||
}
|
||||
|
||||
if (contain(arg, ".") != -1)
|
||||
{
|
||||
@ -271,7 +289,6 @@ public cmdUnban(id, level, cid)
|
||||
|
||||
show_activity_key("ADMIN_UNBAN_1", "ADMIN_UNBAN_2", name, arg);
|
||||
|
||||
get_user_authid(id, authid, charsmax(authid))
|
||||
log_amx("Cmd: ^"%s<%d><%s><>^" unban ^"%s^"", name, get_user_userid(id), authid, arg)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
@ -401,6 +418,7 @@ public cmdAddBan(id, level, cid)
|
||||
show_activity_key("ADMIN_ADDBAN_1", "ADMIN_ADDBAN_2", name, arg);
|
||||
|
||||
get_user_authid(id, authid, charsmax(authid))
|
||||
TrieSetString(g_tempBans, arg, authid)
|
||||
log_amx("Cmd: ^"%s<%d><%s><>^" ban ^"%s^" (minutes ^"%s^") (reason ^"%s^")", name, get_user_userid(id), authid, arg, minutes, reason)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
@ -422,6 +440,18 @@ public cmdBan(id, level, cid)
|
||||
if (!player)
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
new nNum = str_to_num(minutes)
|
||||
if( nNum < 0 ) // since negative values result in permanent bans
|
||||
{
|
||||
nNum = 0;
|
||||
minutes = "0";
|
||||
}
|
||||
if( ~get_user_flags(id) & ( ADMIN_BAN | ADMIN_RCON ) && (nNum <= 0 || nNum > get_pcvar_num(p_amx_tempban_maxtime)) )
|
||||
{
|
||||
console_print(id, "%L", id, "NO_ACC_COM"); // may be someone wants to create a new sentence and to translate it in all languages ?
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
new authid[32], name2[32], authid2[32], name[32]
|
||||
new userid2 = get_user_userid(player)
|
||||
|
||||
@ -431,8 +461,10 @@ public cmdBan(id, level, cid)
|
||||
get_user_name(id, name, charsmax(name))
|
||||
|
||||
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, minutes, reason)
|
||||
|
||||
TrieSetString(g_tempBans, authid2, authid); // store all bans in case a permanent ban would override a temporary one.
|
||||
|
||||
new temp[64], banned[16], nNum = str_to_num(minutes)
|
||||
new temp[64], banned[16]
|
||||
if (nNum)
|
||||
formatex(temp, charsmax(temp), "%L", player, "FOR_MIN", minutes)
|
||||
else
|
||||
@ -492,10 +524,17 @@ public cmdBanIP(id, level, cid)
|
||||
new player = cmd_target(id, target, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF)
|
||||
|
||||
if (!player)
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
new nNum = str_to_num(minutes)
|
||||
if( nNum < 0 ) // since negative values result in permanent bans
|
||||
{
|
||||
// why is this here?
|
||||
// no idea
|
||||
// player = cmd_target(id, target, 9);
|
||||
nNum = 0;
|
||||
minutes = "0";
|
||||
}
|
||||
if( ~get_user_flags(id) & ( ADMIN_BAN | ADMIN_RCON ) && (nNum <= 0 || nNum > get_pcvar_num(p_amx_tempban_maxtime)) )
|
||||
{
|
||||
console_print(id, "%L", id, "NO_ACC_COM"); // may be someone wants to create a new sentence and to translate it in all languages ?
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
@ -509,7 +548,9 @@ public cmdBanIP(id, level, cid)
|
||||
|
||||
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, minutes, reason)
|
||||
|
||||
new temp[64], banned[16], nNum = str_to_num(minutes)
|
||||
TrieSetString(g_tempBans, authid2, authid);
|
||||
|
||||
new temp[64], banned[16]
|
||||
if (nNum)
|
||||
formatex(temp, charsmax(temp), "%L", player, "FOR_MIN", minutes)
|
||||
else
|
||||
|
@ -54,6 +54,9 @@ new g_clcmdNum
|
||||
|
||||
new g_coloredMenus
|
||||
|
||||
new p_amx_tempban_maxtime;
|
||||
new Trie:g_tempBans;
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Players Menu", AMXX_VERSION_STR, "AMXX Dev Team")
|
||||
@ -63,7 +66,7 @@ public plugin_init()
|
||||
register_dictionary("admincmd.txt")
|
||||
|
||||
register_clcmd("amx_kickmenu", "cmdKickMenu", ADMIN_KICK, "- displays kick menu")
|
||||
register_clcmd("amx_banmenu", "cmdBanMenu", ADMIN_BAN, "- displays ban menu")
|
||||
register_clcmd("amx_banmenu", "cmdBanMenu", ADMIN_BAN|ADMIN_BAN_TEMP, "- displays ban menu")
|
||||
register_clcmd("amx_slapmenu", "cmdSlapMenu", ADMIN_SLAY, "- displays slap/slay menu")
|
||||
register_clcmd("amx_teammenu", "cmdTeamMenu", ADMIN_LEVEL_A, "- displays team menu")
|
||||
register_clcmd("amx_clcmdmenu", "cmdClcmdMenu", ADMIN_LEVEL_A, "- displays client cmds menu")
|
||||
@ -82,6 +85,22 @@ public plugin_init()
|
||||
load_settings(clcmds_ini_file)
|
||||
}
|
||||
|
||||
public plugin_cfg()
|
||||
{
|
||||
new x = get_xvar_id("g_tempBans")
|
||||
if( x )
|
||||
{
|
||||
g_tempBans = Trie:get_xvar_num(x)
|
||||
}
|
||||
new amx_tempban_maxtime[] = "amx_tempban_maxtime";
|
||||
p_amx_tempban_maxtime = get_cvar_pointer(amx_tempban_maxtime);
|
||||
if( !p_amx_tempban_maxtime )
|
||||
{
|
||||
p_amx_tempban_maxtime = register_cvar(amx_tempban_maxtime, "4320");
|
||||
server_cmd("amx_cvar add %s", amx_tempban_maxtime);
|
||||
}
|
||||
}
|
||||
|
||||
/* Ban menu */
|
||||
|
||||
public actionBanMenu(id, key)
|
||||
@ -108,6 +127,14 @@ public actionBanMenu(id, key)
|
||||
|
||||
default:
|
||||
{
|
||||
new banTime = g_menuSettings[id]
|
||||
if( ~get_user_flags(id) & ( ADMIN_BAN | ADMIN_RCON ) && (banTime <= 0 || banTime > get_pcvar_num(p_amx_tempban_maxtime)) )
|
||||
{
|
||||
console_print(id, "%L", id, "NO_ACC_COM");
|
||||
displayBanMenu(id, g_menuPosition[id])
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||
|
||||
new name[32], name2[32], authid[32], authid2[32]
|
||||
@ -154,9 +181,19 @@ public actionBanMenu(id, key)
|
||||
new ipa[32]
|
||||
get_user_ip(player, ipa, 31, 1)
|
||||
server_cmd("addip %d %s;writeip", g_menuSettings[id], ipa)
|
||||
if( g_tempBans )
|
||||
{
|
||||
TrieSetString(g_tempBans, ipa, authid)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
server_cmd("banid %d #%d kick;writeid", g_menuSettings[id], userid2)
|
||||
if( g_tempBans )
|
||||
{
|
||||
TrieSetString(g_tempBans, authid2, authid)
|
||||
}
|
||||
}
|
||||
|
||||
server_exec()
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#define ADMIN_LEVEL_G (1<<18) /* flag "s" */
|
||||
#define ADMIN_LEVEL_H (1<<19) /* flag "t" */
|
||||
#define ADMIN_MENU (1<<20) /* flag "u" */
|
||||
#define ADMIN_BAN_TEMP (1<<21) /* flag "v" */
|
||||
#define ADMIN_ADMIN (1<<24) /* flag "y" */
|
||||
#define ADMIN_USER (1<<25) /* flag "z" */
|
||||
|
||||
|
@ -63,6 +63,9 @@ new g_TeamCommands[4][40];
|
||||
new g_PrettyTeamNames[4][32];
|
||||
new g_AbbreviatedTeamNames[4][10];
|
||||
|
||||
new p_amx_tempban_maxtime;
|
||||
new Trie:g_tempBans;
|
||||
|
||||
// This function failsafes to the readyroom
|
||||
stock GetNSTeam(id, abbreviation[], abrsize)
|
||||
{
|
||||
@ -126,7 +129,7 @@ public plugin_init()
|
||||
register_dictionary("plmenu.txt")
|
||||
|
||||
register_clcmd("amx_kickmenu", "cmdKickMenu", ADMIN_KICK, "- displays kick menu")
|
||||
register_clcmd("amx_banmenu", "cmdBanMenu", ADMIN_BAN, "- displays ban menu")
|
||||
register_clcmd("amx_banmenu", "cmdBanMenu", ADMIN_BAN|ADMIN_BAN_TEMP, "- displays ban menu")
|
||||
register_clcmd("amx_slapmenu", "cmdSlapMenu", ADMIN_SLAY, "- displays slap/slay menu")
|
||||
register_clcmd("amx_teammenu", "cmdTeamMenu", ADMIN_LEVEL_A, "- displays team menu")
|
||||
register_clcmd("amx_clcmdmenu", "cmdClcmdMenu", ADMIN_LEVEL_A, "- displays client cmds menu")
|
||||
@ -226,6 +229,23 @@ public plugin_init()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public plugin_cfg()
|
||||
{
|
||||
new x = get_xvar_id("g_tempBans")
|
||||
if( x )
|
||||
{
|
||||
g_tempBans = Trie:get_xvar_num(x)
|
||||
}
|
||||
new amx_tempban_maxtime[] = "amx_tempban_maxtime";
|
||||
p_amx_tempban_maxtime = get_cvar_pointer(amx_tempban_maxtime);
|
||||
if( !p_amx_tempban_maxtime )
|
||||
{
|
||||
p_amx_tempban_maxtime = register_cvar(amx_tempban_maxtime, "4320");
|
||||
server_cmd("amx_cvar add %s", amx_tempban_maxtime);
|
||||
}
|
||||
}
|
||||
|
||||
public plmenu_setbantimes()
|
||||
{
|
||||
new buff[32];
|
||||
@ -298,6 +318,13 @@ public actionBanMenu(id, key)
|
||||
case 9: displayBanMenu(id, --g_menuPosition[id])
|
||||
default:
|
||||
{
|
||||
new banTime = g_menuSettings[id]
|
||||
if( ~get_user_flags(id) & ( ADMIN_BAN | ADMIN_RCON ) && (banTime <= 0 || banTime > get_pcvar_num(p_amx_tempban_maxtime)) )
|
||||
{
|
||||
console_print(id, "%L", id, "NO_ACC_COM");
|
||||
displayBanMenu(id, g_menuPosition[id])
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||
new name[32], name2[32], authid[32], authid2[32]
|
||||
|
||||
@ -307,10 +334,10 @@ public actionBanMenu(id, key)
|
||||
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, banTime)
|
||||
|
||||
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])
|
||||
|
||||
if (g_menuSettings[id]==0) // permanent
|
||||
if ( !banTime ) // permanent
|
||||
{
|
||||
new maxpl = get_maxplayers();
|
||||
for (new i = 1; i <= maxpl; i++)
|
||||
@ -321,7 +348,7 @@ public actionBanMenu(id, key)
|
||||
else
|
||||
{
|
||||
new tempTime[32];
|
||||
formatex(tempTime,sizeof(tempTime)-1,"%d",g_menuSettings[id]);
|
||||
formatex(tempTime,sizeof(tempTime)-1,"%d",banTime);
|
||||
new maxpl = get_maxplayers();
|
||||
for (new i = 1; i <= maxpl; i++)
|
||||
{
|
||||
@ -340,11 +367,19 @@ public actionBanMenu(id, key)
|
||||
new ipa[32]
|
||||
get_user_ip(player, ipa, 31, 1)
|
||||
|
||||
server_cmd("addip %d %s;writeip", g_menuSettings[id], ipa)
|
||||
server_cmd("addip %d %s;writeip", banTime, ipa)
|
||||
if( g_tempBans )
|
||||
{
|
||||
TrieSetString(g_tempBans, ipa, authid)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
server_cmd("banid %d #%d kick;writeid", g_menuSettings[id], userid2)
|
||||
server_cmd("banid %d #%d kick;writeid", banTime, userid2)
|
||||
if( g_tempBans )
|
||||
{
|
||||
TrieSetString(g_tempBans, authid2, authid)
|
||||
}
|
||||
}
|
||||
|
||||
server_exec()
|
||||
|
@ -77,6 +77,8 @@ new g_CSTeamiNumbers[3] = {
|
||||
6
|
||||
}
|
||||
|
||||
new p_amx_tempban_maxtime;
|
||||
new Trie:g_tempBans;
|
||||
|
||||
public plugin_natives()
|
||||
{
|
||||
@ -92,7 +94,7 @@ public plugin_init()
|
||||
register_dictionary("plmenu.txt")
|
||||
|
||||
register_clcmd("amx_kickmenu", "cmdKickMenu", ADMIN_KICK, "- displays kick menu")
|
||||
register_clcmd("amx_banmenu", "cmdBanMenu", ADMIN_BAN, "- displays ban menu")
|
||||
register_clcmd("amx_banmenu", "cmdBanMenu", ADMIN_BAN|ADMIN_BAN_TEMP, "- displays ban menu")
|
||||
register_clcmd("amx_slapmenu", "cmdSlapMenu", ADMIN_SLAY, "- displays slap/slay menu")
|
||||
register_clcmd("amx_teammenu", "cmdTeamMenu", ADMIN_LEVEL_A, "- displays team menu")
|
||||
register_clcmd("amx_clcmdmenu", "cmdClcmdMenu", ADMIN_LEVEL_A, "- displays client cmds menu")
|
||||
@ -136,6 +138,23 @@ public plugin_init()
|
||||
if (module_exists("cstrike"))
|
||||
g_cstrike = 1
|
||||
}
|
||||
|
||||
public plugin_cfg()
|
||||
{
|
||||
new x = get_xvar_id("g_tempBans")
|
||||
if( x )
|
||||
{
|
||||
g_tempBans = Trie:get_xvar_num(x)
|
||||
}
|
||||
new amx_tempban_maxtime[] = "amx_tempban_maxtime";
|
||||
p_amx_tempban_maxtime = get_cvar_pointer(amx_tempban_maxtime);
|
||||
if( !p_amx_tempban_maxtime )
|
||||
{
|
||||
p_amx_tempban_maxtime = register_cvar(amx_tempban_maxtime, "4320");
|
||||
server_cmd("amx_cvar add %s", amx_tempban_maxtime);
|
||||
}
|
||||
}
|
||||
|
||||
public plmenu_setbantimes()
|
||||
{
|
||||
new buff[32];
|
||||
@ -223,6 +242,13 @@ public actionBanMenu(id, key)
|
||||
case 9: displayBanMenu(id, --g_menuPosition[id])
|
||||
default:
|
||||
{
|
||||
new banTime = g_menuSettings[id]
|
||||
if( ~get_user_flags(id) & ( ADMIN_BAN | ADMIN_RCON ) && (banTime <= 0 || banTime > get_pcvar_num(p_amx_tempban_maxtime)) )
|
||||
{
|
||||
console_print(id, "%L", id, "NO_ACC_COM");
|
||||
displayBanMenu(id, g_menuPosition[id])
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||
new name[32], name2[32], authid[32], authid2[32]
|
||||
|
||||
@ -232,10 +258,10 @@ public actionBanMenu(id, key)
|
||||
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, banTime)
|
||||
|
||||
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])
|
||||
|
||||
if (g_menuSettings[id]==0) // permanent
|
||||
if ( !banTime ) // permanent
|
||||
{
|
||||
new maxpl = get_maxplayers();
|
||||
for (new i = 1; i <= maxpl; i++)
|
||||
@ -246,7 +272,7 @@ public actionBanMenu(id, key)
|
||||
else
|
||||
{
|
||||
new tempTime[32];
|
||||
formatex(tempTime,sizeof(tempTime)-1,"%d",g_menuSettings[id]);
|
||||
formatex(tempTime,sizeof(tempTime)-1,"%d",banTime);
|
||||
new maxpl = get_maxplayers();
|
||||
for (new i = 1; i <= maxpl; i++)
|
||||
{
|
||||
@ -265,11 +291,19 @@ public actionBanMenu(id, key)
|
||||
new ipa[32]
|
||||
get_user_ip(player, ipa, 31, 1)
|
||||
|
||||
server_cmd("addip %d %s;writeip", g_menuSettings[id], ipa)
|
||||
server_cmd("addip %d %s;writeip", banTime, ipa)
|
||||
if( g_tempBans )
|
||||
{
|
||||
TrieSetString(g_tempBans, ipa, authid)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
server_cmd("banid %d #%d kick;writeid", g_menuSettings[id], userid2)
|
||||
server_cmd("banid %d #%d kick;writeid", banTime, userid2)
|
||||
if( g_tempBans )
|
||||
{
|
||||
TrieSetString(g_tempBans, authid2, authid)
|
||||
}
|
||||
}
|
||||
|
||||
server_exec()
|
||||
|
@ -56,6 +56,9 @@ new g_coloredMenus
|
||||
|
||||
new g_teamNames[6][] = {"", "Blue", "Red", "Yellow", "Green", "Spectator"}
|
||||
|
||||
new p_amx_tempban_maxtime;
|
||||
new Trie:g_tempBans;
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("Players Menu",AMXX_VERSION_STR,"AMXX Dev Team")
|
||||
@ -65,7 +68,7 @@ public plugin_init()
|
||||
register_dictionary("admincmd.txt")
|
||||
|
||||
register_clcmd("amx_kickmenu","cmdKickMenu",ADMIN_KICK,"- displays kick menu")
|
||||
register_clcmd("amx_banmenu","cmdBanMenu",ADMIN_BAN,"- displays ban menu")
|
||||
register_clcmd("amx_banmenu","cmdBanMenu",ADMIN_BAN|ADMIN_BAN_TEMP,"- displays ban menu")
|
||||
register_clcmd("amx_slapmenu","cmdSlapMenu",ADMIN_SLAY,"- displays slap/slay menu")
|
||||
register_clcmd("amx_teammenu","cmdTeamMenu",ADMIN_LEVEL_A,"- displays team menu")
|
||||
register_clcmd("amx_clcmdmenu","cmdClcmdMenu",ADMIN_LEVEL_A,"- displays client cmds menu")
|
||||
@ -84,6 +87,22 @@ public plugin_init()
|
||||
load_settings(clcmds_ini_file)
|
||||
}
|
||||
|
||||
public plugin_cfg()
|
||||
{
|
||||
new x = get_xvar_id("g_tempBans")
|
||||
if( x )
|
||||
{
|
||||
g_tempBans = Trie:get_xvar_num(x)
|
||||
}
|
||||
new amx_tempban_maxtime[] = "amx_tempban_maxtime";
|
||||
p_amx_tempban_maxtime = get_cvar_pointer(amx_tempban_maxtime);
|
||||
if( !p_amx_tempban_maxtime )
|
||||
{
|
||||
p_amx_tempban_maxtime = register_cvar(amx_tempban_maxtime, "4320");
|
||||
server_cmd("amx_cvar add %s", amx_tempban_maxtime);
|
||||
}
|
||||
}
|
||||
|
||||
/* Ban menu */
|
||||
|
||||
public actionBanMenu(id, key)
|
||||
@ -110,6 +129,13 @@ public actionBanMenu(id, key)
|
||||
|
||||
default:
|
||||
{
|
||||
new banTime = g_menuSettings[id]
|
||||
if( ~get_user_flags(id) & ( ADMIN_BAN | ADMIN_RCON ) && (banTime <= 0 || banTime > get_pcvar_num(p_amx_tempban_maxtime)) )
|
||||
{
|
||||
console_print(id, "%L", id, "NO_ACC_COM");
|
||||
displayBanMenu(id, g_menuPosition[id])
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
|
||||
|
||||
new name[32], name2[32], authid[32], authid2[32]
|
||||
@ -156,9 +182,19 @@ public actionBanMenu(id, key)
|
||||
new ipa[32]
|
||||
get_user_ip(player, ipa, 31, 1)
|
||||
server_cmd("addip %d %s;writeip", g_menuSettings[id], ipa)
|
||||
if( g_tempBans )
|
||||
{
|
||||
TrieSetString(g_tempBans, ipa, authid)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
server_cmd("banid %d #%d kick;writeid", g_menuSettings[id], userid2)
|
||||
if( g_tempBans )
|
||||
{
|
||||
TrieSetString(g_tempBans, authid2, authid)
|
||||
}
|
||||
}
|
||||
|
||||
server_exec()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user