PHP Code:
#include amxmodx
#include amxmisc
#define PLUGIN "Long Name And Player Kicker"
#define VERSION "1.0"
#define AUTHOR "BodyBuilder"
#define NICKFILE "addons/amxmodx/data/PlayersKicker.ini"
new
max_name_leght,
max_name_kick_text_1,
max_name_kick_text_2
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
max_name_leght = register_cvar("max_name_leght","15")
max_name_kick_text_1 = register_cvar("max_name_kick_text_a","Players Not Allowed")
max_name_kick_text_2 = register_cvar("max_name_kick_text_b","Nick Is Too Long Max Length: ")
}
public client_connect(id)
{
static
max_name_kick_text_a[32],
max_name_kick_text_b[32],
maxname[32],
authid[32],
get
get_pcvar_string(max_name_kick_text_1,max_nam e_kick_text_a,31)
get_pcvar_string(max_name_kick_text_2,max_nam e_kick_text_b,31)
get_user_name(id,maxname,sizeof (maxname) - 1)
if(nick_isvalid(maxname) == 0)
{
get_user_authid(id,authid,31)
server_cmd("kick #%d ^"%s^"",get_user_userid(id),max_name_kick_tex t_a)
}
get = get_pcvar_num(max_name_leght)
if(strlen(maxname) > get)
{
maxname[get] = '^0'
get_user_authid(id,authid,31)
server_cmd("kick #%d ^"%s %d^"",get_user_userid(id),max_name_kick_text_ b,get)
}
}
public plugin_precache()
{
if(!file_exists(NICKFILE))
{
write_file(NICKFILE,":::Player'S Kicker:::",-1)
}
return PLUGIN_CONTINUE
}
public nick_isvalid(maxname[64])
{
if(!file_exists(NICKFILE))
{
write_file(NICKFILE,":::Player'S Kicker:::",-1)
return 1
}
new line, text[64], txtlen
while((line = read_file(NICKFILE,line,text,63,txtlen)) != 0)
{
if(equali(text,maxname))
{
nick_kick(maxname)
return 0
}
}
return 1
}
public nick_kick(maxname[64])
{
new checkstring[6]
copy(checkstring,5,maxname)
if(equali(checkstring,"kick "))
{
return 1
}
return 0
}