搜索
查看: 2441|回复: 1

请各位高手帮我看一下!

[复制链接]
发表于 2008-12-12 19:57:49 | 显示全部楼层 |阅读模式 来自 中国–广东–佛山
#include <amxmodx>
#include <amxmisc>

// Configure this if you would chage the path of the config file
new configfile[] = "addons/amxmodx/configs/status_monitor.cfg"
new show_status[33]
public plugin_init() {
register_plugin("statusmonitor","1.1a","eXoR")

register_cvar("sm_admins","0")
register_cvar("sm_admin_pw","!noob!")

register_clcmd("say","check_say")
register_clcmd("say_team","check_say")
register_concmd("status_mon","statusmonitor",ADMIN_LEVEL_A,"Shows the status monitor")
register_concmd("sm_admins","smadminhelp",ADMIN_LEVEL_A,"Define if the Status Monitor is only for Admins")
register_concmd("sm_admin_pw","smadminhelp_pw",ADMIN_LEVEL_A,"Define a Password for using custom Admins")

set_task(1.0,"status",1621,"",1,"b")

server_cmd("exec %s",configfile)
}
public client_putinserver(id) {
set_task(1.0,"serverconnect")
}
public serverconnect(id,level,cid) {
if(get_cvar_num("sm_admins") == 0){
set_task(4.0,"checkshowstatus",id)
}else{
new rem[32]
new statusmon_pw_text[32]
get_user_info(0,"s_m_pw",rem,31)
get_cvar_string("sm_admin_pw",statusmon_pw_text,31)
if(cmd_access(id,level,cid,1) || equali(rem,statusmon_pw_text)){
set_task(4.0,"checkshowstatus",id)
set_task(5.0,"adminusersay",id)
}
}
}
public adminusersay(id,level,cid) {
new rem[32]
new statusmon_pw_text[32]
get_user_info(0,"s_m_pw",rem,31)
get_cvar_string("sm_admin_pw",statusmon_pw_text,31)
if(cmd_access(id,level,cid,1) || equali(rem,statusmon_pw_text)) {
client_print(id,print_chat,"[S-M] You have Admin rights to use the Stauts Monitor!")
}
}
public smadminhelp(id,level,cid) {
if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED

new cmd1[32]
read_argv(1,cmd1,31)
if(cmd1[0]) {
new act = str_to_num(cmd1)
set_cvar_num("sm_admins",act)
}

new statusmonitrocvar = get_cvar_num("sm_admins")
client_print(id,print_console,"sm_admins is ^"%d^"^n 0 = All Users, 1 = Only Admins",statusmonitrocvar)
return PLUGIN_HANDLED
}
public smadminhelp_pw(id,level,cid) {
if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED

new cmd2[32]
read_argv(1,cmd2,31)
if(cmd2[0]) {
set_cvar_string("sm_admin_pw",cmd2)
}

new statusmonitrocvar_pw[32]
get_cvar_string("sm_admin_pw",statusmonitrocvar_pw,31)
client_print(id,print_console,"sm_admin_pw is ^"%s^"^n^n This is used for custom Admins! You must set the Password with^n setinfo ^"s_m_pw^" ^"%s^"",statusmonitrocvar_pw,statusmonitrocvar_pw)
return PLUGIN_HANDLED
}
public checkshowstatus(id) {
new rem[32]
get_user_info(0,"status_monitor",rem,31)
new nb = str_to_num( rem )
if(nb == 1){
show_status[id] = 1
}else{
show_status[id] = 0
}
}

public client_disconnect(id) {
if(show_status[id] == 0) {
client_cmd(id,"setinfo ^"status_monitor^" ^"0^"")
}else{
client_cmd(id,"setinfo ^"status_monitor^" ^"1^"")
}
}
public statusmonitor(id,level,cid) {
if(get_cvar_num("sm_admins") == 0){
if(show_status[id] == 0) {

show_status[id] = 1

client_cmd(id,"spk ^"status screen activated^"")
client_print(id,print_chat,"[S-M] The Status Monitor will be showed at the next server connect")
client_print(id,print_center,"Status Monitor Activated")
client_cmd(id,"setinfo ^"status_monitor^" ^"1^"")

}else{

show_status[id] = 0
client_cmd(id,"spk ^"status screen deactivated^"")
client_print(id,print_chat,"[S-M] The Status Monitor will be longer showed at the next server connect")
client_print(id,print_center,"Status Monitor Deactivated")
client_cmd(id,"setinfo ^"status_monitor^" ^"0^"")
}
}else{
new rem[32]
new statusmon_pw_text[32]
get_user_info(0,"s_m_pw",rem,31)
get_cvar_string("sm_admin_pw",statusmon_pw_text,31)
if(cmd_access(id,level,cid,1) || !equali(rem,statusmon_pw_text)) {
client_print(id,print_chat,"[S-M] Only Admins can use the Status Monitor, sorry")
return PLUGIN_HANDLED
}else{
if(show_status[id] == 0) {

show_status[id] = 1

client_cmd(id,"spk ^"status screen activated^"")
client_print(id,print_chat,"[S-M] The Status Monitor will be showed at the next server connect")
client_print(id,print_center,"Status Monitor Activated")
client_cmd(id,"setinfo ^"status_monitor^" ^"1^"")

}else{

show_status[id] = 0
client_cmd(id,"spk ^"status screen deactivated^"")
client_print(id,print_chat,"[S-M] The Status Monitor will be longer showed at the next server connect")
client_print(id,print_center,"Status Monitor Deactivated")
client_cmd(id,"setinfo ^"status_monitor^" ^"0^"")
}
}
}
return PLUGIN_HANDLED
}
public status() {
for(new id = 1; id < 33; id++) {
if(show_status[id]) {
new ping,loss
new frags = get_user_frags(id)
new deaths = get_user_deaths(id)
new timer = get_user_time(id)
new timeleft = get_timeleft()
new cmin = timer/60
new csec = timer-cmin*60
new ctime[64]
new nick[255]
new ip[255]
new cmax = get_maxplayers()
new players = get_playersnum()
new slots = cmax-players
new Players[32]
new playercount

timeleft /= 60
get_players(Players, playercount)
get_user_name(id,nick,254)
get_user_ip(id,ip,254,1)
get_user_ping(id,ping,loss)
get_time("%H:%M:%S",ctime,63)

set_hudmessage(100,255,0,0.50,0.02,0,0.0,1.09, 0.0, 0.0, 2)
show_hudmessage(id,"在线时间: %d Min %d Secs^n当前时间: %s^n换图时间: %d Min^n在线人数:%d / %d ",cmin,csec,ctime,timeleft,slots,Players)
set_hudmessage(100,255,0,0.17,0.02,0,0.0,1.09, 0.0, 0.0, 3)
show_hudmessage(id,"延迟: %d^n杀敌: %d / 死亡: %d^n你的IP: %s^n玩家: %s",ping,frags,deaths,ip,nick)
}
}
}
public check_say(id,level,cid) {
new said[32]
read_args(said,31)
if (equali(said,"^"/status^"") || equali(said,"^"status^""))
statusmonitor(id,level,cid)
return PLUGIN_CONTINUE
}

请帮我看一下!
这个是我从国外网下的,可以编译!
但是在运行的时候老是会在控制台出现下面的东西!
L 12/14/2008 - 10:48:58: Invalid player id 0
L 12/14/2008 - 10:48:58: [AMXX] Run time error 10 (plugin "status_monitor.amxx") (native "get_user_info") - debug not enabled!
L 12/14/2008 - 10:48:58: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
发表于 2008-12-22 15:48:32 | 显示全部楼层 来自 中国–湖南–长沙

回复: 请各位高手帮我看一下!

意思是说你这个插件需要debug模式。
打开plugins.ini这个配置文件,在status_monitor.amxx文字后面空格再加上debug就OK了。
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表