Amzbans ban cmd.
So I'm using the newest amxbans. And if I'm banning using command like that:
amx_ban player1 60 reason1
All works great, reson is exactly reson1
but if I'll ban with:
amx_ban "player1" "60" "reason1"
the reason will be:
60" "reason1".
This is code of command:
Code:
public cmdBan(id, level, cid)
{
/* Checking if the admin has the right access */
if (!cmd_access(id,level,cid,3))
return PLUGIN_HANDLED
new bool:serverCmd = false
// Determine if this was a server command or a command issued by a player in the game
if ( id == 0 )
serverCmd = true;
g_menuban_type[id] = 0
new text[128]
read_args(text, 127)
// get player ident and bantime depending on the ban cmd format (old or new)
new ban_length[50]
if(get_pcvar_num(pcvar_newbancmd))
parse(text, g_ident, 49, ban_length, 49)
else
parse(text, ban_length, 49, g_ident, 49)
trim(g_ident)
trim(ban_length)
// Check so the ban command has the right format
if( !is_str_num(ban_length) || read_argc() < 3 )
{
if(get_pcvar_num(pcvar_newbancmd))
client_print(id,print_console,"[AMXBans] %L",LANG_PLAYER,"AMX_BAN_SYNTAX_NEW")
else
client_print(id,print_console,"[AMXBans] %L",LANG_PLAYER,"AMX_BAN_SYNTAX")
return PLUGIN_HANDLED
}
//new length1 = strlen(ban_length)
//new length2 = strlen(g_ident)
//new length = length1 + length2
//length+=2
new length = strlen(ban_length) + strlen(g_ident) + 2
// get and format the ban reason
new reason[128]
read_args(reason,127)
formatex(g_choiceReason[id], charsmax(g_choiceReason[]), "%s", reason[length])
trim(g_choiceReason[id])
remove_quotes(g_choiceReason[id])
//if the reason is empty use the default ban reason from cvar
if(!strlen(g_choiceReason[id])) {
get_pcvar_string(pcvar_default_banreason,g_choiceReason[id],charsmax(g_choiceReason[]))
}
g_choiceTime[id] = abs(str_to_num(ban_length))
new cTimeLength[128]
if (g_choiceTime[id] > 0)
get_time_length(id, g_choiceTime[id], timeunit_minutes, cTimeLength, 127)
else
format(cTimeLength, 127, "%L", LANG_PLAYER, "TIME_ELEMENT_PERMANENTLY")
// This stops admins from banning perm in console if not adminflag n
if(!(get_user_flags(id) & get_higher_ban_time_admin_flag()) && g_choiceTime[id] == 0)
{
client_print(id,print_console,"[AMXBans] %L",LANG_PLAYER,"NOT_BAN_PERMANENT")
return PLUGIN_HANDLED
}
// Try to find the player that should be banned
g_choicePlayerId[id] = locate_player(id, g_ident)
// Player is a BOT or has immunity
if (g_choicePlayerId[id] == -1)
return PLUGIN_HANDLED
if(g_being_banned[g_choicePlayerId[id]]) {
if ( get_pcvar_num(pcvar_debug) >= 1 )
log_amx("[AMXBans Blocking doubleban(g_being_banned)] Playerid: %d BanLenght: %s Reason: %s", g_choicePlayerId[id], g_choiceTime[id], g_choiceReason[id])
return PLUGIN_HANDLED
}
g_being_banned[g_choicePlayerId[id]] = true
if ( get_pcvar_num(pcvar_debug) >= 1 )
log_amx("[AMXBans cmdBan function 1]Playerid: %d", g_choicePlayerId[id])
if (g_choicePlayerId[id])
{
get_user_authid(g_choicePlayerId[id], g_choicePlayerAuthid[id], 49)
get_user_ip(g_choicePlayerId[id], g_choicePlayerIp[id], 29, 1)
}
else
{
g_being_banned[0]=false
if (serverCmd)
server_print("[AMXBans] The Player %s was not found",g_ident)
else
console_print(id, "[AMXBans] The Player %s was not found",g_ident)
if ( get_pcvar_num(pcvar_debug) >= 1 )
log_amx("[AMXBans] Player %s could not be found",g_ident)
return PLUGIN_HANDLED
}
if(!get_ban_type(g_ban_type[id],charsmax(g_ban_type[]),g_choicePlayerAuthid[id],g_choicePlayerIp[id])) {
log_amx("[AMXBans ERROR cmdBan] Steamid / IP Invalid! Bantype: <%s> | Authid: <%s> | IP: <%s>",g_ban_type[id],g_choicePlayerAuthid[id],g_choicePlayerIp[id])
g_being_banned[g_choicePlayerId[id]]=false
return PLUGIN_HANDLED
}
if (equal(g_ban_type[id], "S"))
{
formatex(g_SqlX_Cache, charsmax(g_SqlX_Cache),"SELECT player_id FROM %s WHERE player_id='%s' AND expired=0", tbl_bans, g_choicePlayerAuthid[id])
if ( get_pcvar_num(pcvar_debug) >= 1 )
log_amx("[AMXBans cmdBan] Banned a player by SteamID: %s",g_choicePlayerAuthid[id])
}
else
{
formatex(g_SqlX_Cache, charsmax(g_SqlX_Cache),"SELECT player_ip FROM %s WHERE player_ip='%s' AND expired=0", tbl_bans, g_choicePlayerIp[id])
if ( get_pcvar_num(pcvar_debug) >= 1 )
log_amx("[AMXBans cmdBan] Banned a player by IP/steamID: %s",g_choicePlayerIp[id])
}
new pquery[1024]
prepare_prefix(g_SqlX_Cache,pquery,charsmax(pquery))
new data[1]
data[0] = id
SQL_ThreadQuery(g_SqlX, "cmd_ban_", pquery, data, 1)
return PLUGIN_HANDLED
}
Anyone knows how to fix that?-.-
|