AdvancedMotd死后无SXE弹出窗口修改的问题
由于对名字字符检测不懂,所以通过对名字长度的检测有没有SXE,可测试总没通过,请各位指点指点,谢谢。源代码:#include <amxmodx>#include <amxmisc>
#define PLUGIN "Advanced Motd"
#define VERSION "1.2"
#define AUTHOR "KinSprite"
#define MAX_MOTD_SUPPORT 5
#define MOTD_FOLDER "motd"
#define MOTD_HEADER_CONFIG "motd_header.cfg"
new g_advancedmotd
new motd
new motd_header
new max_motd
new showmotd_counter
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_reloadmotd","cmd_reloadmotd",ADMIN_IMMUNITY," - reload Advanced Motd")
g_advancedmotd = register_cvar("amx_advancedmotd","1")
set_task(1.2,"load_motd")
register_event("DeathMsg", "show_Advmotd","a")
register_cvar( "amx_namelen", "10")
return PLUGIN_CONTINUE
}
public load_motd(id)
{
new cfg_path
get_configsdir(cfg_path,127)
new motd_path
format(motd_path,159,"%s/%s",cfg_path,MOTD_FOLDER)
new path
new handle = open_dir(motd_path,path,63)
if(handle!=0)
{
new buff
new i
for(i=0;i<MAX_MOTD_SUPPORT+2;i++)
{
if(next_file(handle, buff, 63))
max_motd++
else
continue
}
close_dir(handle)
max_motd-- // include parent dir,so max_motd -1
new path_name
for(i=0;i<max_motd;i++)
{
format(path_name,255,"%s/%s",motd_path,buff)
read_motdfile(path_name,motd)
}
}
return PLUGIN_HANDLED
}
// read motd file into memory; not nead to read file again every show motd.
stock read_motdfile(filename[],out_text[])
{
new handle = fopen(filename,"rt")
if(handle!=0)
{
new line_len = file_size(filename,1)
new text_buff,buffer
new line
for(;line<line_len;line++)
{
fgets(handle, buffer, 1023)
add(text_buff,1199,buffer)
}
fclose(handle)
copy(out_text,1199,text_buff)
}
}
public cmd_reloadmotd(id,level,cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
}
public show_Advmotd(id)
{
new szName;
get_user_info( id, "name", szName, 31);
new nMaxLen = get_cvar_num("amx_namelen");
if( strlen( szName) > nMaxLen)
{
new player = read_data(2)
new param
param=player
set_task(1.8,"client_show_motd",5532+player,param,1)
}
return PLUGIN_HANDLED
}
public client_show_motd(param[])
{
new counter = showmotd_counter]
show_motd(param,motd,motd_header)
}
页:
[1]