public nativeKick(id, id2, const szReason[])
{
if (!id2)
return PLUGIN_HANDLED
new authid[32], authid2[32], name2[MAX_NAME_LENGTH], name[MAX_NAME_LENGTH], userid2
get_user_authid(id, authid, charsmax(authid))
get_user_authid(id2, authid2, charsmax(authid2))
get_user_name(id2, name2, charsmax(name2))
get_user_name(id, name, charsmax(name))
userid2 = get_user_userid(id2)
log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^" (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, szReason)
show_activity_key("ADMIN_KICK_1", "ADMIN_KICK_2", name, name2);
if (is_user_bot(id2))
server_cmd("kick #%d", userid2)
else
{
if (szReason[0])
server_cmd("kick #%d ^"%s^"", userid2, szReason)
else
server_cmd("kick #%d", userid2)
}
console_print(id, "[AMXX] Client ^"%s^" kicked", name2)
return PLUGIN_HANDLED
}
public nativeBan(id, id2, t, const szReason[])
{
if (!id2)
return PLUGIN_HANDLED
new nNum = t
new const tempBanMaxTime = get_pcvar_num(p_amx_tempban_maxtime);
if( nNum < 0 ) // since negative values result in permanent bans
nNum = 0;
if( !(get_user_flags(id) & ( ADMIN_BAN | ADMIN_RCON )) && (nNum <= 0 || nNum > tempBanMaxTime) )
{
console_print(id, "%L", id, "ADMIN_MUST_TEMPBAN", tempBanMaxTime);
return PLUGIN_HANDLED
}
new authid[32], name2[MAX_NAME_LENGTH], authid2[32], name[MAX_NAME_LENGTH]
new userid2 = get_user_userid(id2)
get_user_authid(id2, authid2, charsmax(authid2))
get_user_authid(id, authid, charsmax(authid))
get_user_name(id2, name2, charsmax(name2))
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, t, szReason)
TrieSetString(g_tempBans, authid2, authid); // store all bans in case a permanent ban would override a temporary one.
new temp[64], banned[16]
if (nNum)
formatex(temp, charsmax(temp), "%L", id2, "FOR_MIN", t)
else
formatex(temp, charsmax(temp), "%L", id2, "PERM")
formatex(banned, charsmax(banned), "%L", id2, "BANNED")
if (szReason[0])
server_cmd("kick #%d ^"%s (%s %s)^";wait;banid %s %s;wait;writeid", userid2, szReason, banned, temp, t, authid2)
else
server_cmd("kick #%d ^"%s %s^";wait;banid %s %s;wait;writeid", userid2, banned, temp, t, authid2)
// Display the message to all clients
new msg[256];
new len;
new players[MAX_PLAYERS], pnum, plr
get_players(players, pnum, "ch")
for (new i; i<pnum; i++)
{
plr = players[i]
len = formatex(msg, charsmax(msg), "%L", plr, "BAN");
len += formatex(msg[len], charsmax(msg) - len, " %s ", name2);
if (nNum)
{
len += formatex(msg[len], charsmax(msg) - len, "%L", plr, "FOR_MIN", t);
}
else
{
len += formatex(msg[len], charsmax(msg) - len, "%L", plr, "PERM");
}
if (strlen(szReason) > 0)
{
formatex(msg[len], charsmax(msg) - len, " (%L: %s)", plr, "REASON", szReason);
}
show_activity_id(plr, id, name, msg);
}
console_print(id, "[AMXX] %L", id, "CLIENT_BANNED", name2)
return PLUGIN_HANDLED
}