搜索
查看: 5134|回复: 11

[AMXX 带源码] 新版排名

[复制链接]
发表于 2009-4-1 23:20:11 | 显示全部楼层 |阅读模式 来自 中国–广东–中山
/* AMXModX Plugin
*
* Author: eXoR
*
* Version: 1.1a
*
* CVars & Commands:
* cvar:        sm_admins 1|0                        |        0 = All Users can use the Status Monitor, 1 = Only admins can use the Status Monitor
* cvar: sm_admin_pw                                |        Set the Admin Pw for custom Admins (setinfo "s_m_pw" "your password")
* cmd:         status (say)                        |        Shows the Status monitor
* cmd:        status_mon (Console)        |        Shows the Status Monitor
*
*
* Credits:
* KleeneX (For Helping)
*
*/

#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(id,"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(id,"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(id,"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(id,"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,"Played time: %d Min  %d Secs^nTime: %s^nTimeleft: %d Min^n%d Slots Free / %d Active Players",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,"Ping: %d^nFrags: %d / Deaths: %d^nYour IP: %s^nYour Nick: %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
}
发表于 2009-4-2 10:46:15 | 显示全部楼层 来自 中国–甘肃–兰州
发个图看看啊
回复

使用道具 举报

发表于 2009-4-2 15:00:41 | 显示全部楼层 来自 中国–湖南–怀化–鹤城区
效果?......
回复

使用道具 举报

发表于 2009-4-2 16:29:27 | 显示全部楼层 来自 中国–广西–防城港
图。。。。。。。。。。
回复

使用道具 举报

发表于 2009-4-2 18:01:20 | 显示全部楼层 来自 中国–福建–厦门
没图等于白发~拿钱走人~
回复

使用道具 举报

发表于 2009-4-2 19:03:10 | 显示全部楼层 来自 中国–北京–北京–海淀区
没有这个插件的效果图吗?
回复

使用道具 举报

发表于 2009-4-3 22:59:05 | 显示全部楼层 来自 中国–云南–曲靖
没图没效果,我去试试玩玩!!
回复

使用道具 举报

发表于 2011-1-2 10:31:51 | 显示全部楼层 来自 中国–广东–汕尾
反正不用钱。玩玩看!
回复

使用道具 举报

发表于 2011-1-2 15:28:36 | 显示全部楼层 来自 中国–湖南–株洲
无图啊~~~:(
回复

使用道具 举报

发表于 2011-1-2 16:23:08 | 显示全部楼层 来自 中国–香港
发个图看看啊
回复

使用道具 举报

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

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