20576526 发表于 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

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
                new statusmon_pw_text
                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
                new statusmon_pw_text
                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,"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
        read_argv(1,cmd1,31)
        if(cmd1) {
                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^"^n0 = 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
        read_argv(1,cmd2,31)
        if(cmd2) {
                set_cvar_string("sm_admin_pw",cmd2)
        }
       
        new statusmonitrocvar_pw
        get_cvar_string("sm_admin_pw",statusmonitrocvar_pw,31)
        client_print(id,print_console,"sm_admin_pw is ^"%s^"^n^nThis 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
        get_user_info(id,"status_monitor",rem,31)
        new nb = str_to_num( rem )
        if(nb == 1){
        show_status = 1
        }else{
        show_status = 0
        }
}

public client_disconnect(id) {
        if(show_status == 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 == 0) {
       
                        show_status = 1
               
                        client_cmd(id,"spk ^"status screen activated^"")
                        client_print(id,print_chat,"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 = 0

                        client_cmd(id,"spk ^"status screen deactivated^"")
                        client_print(id,print_chat,"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
                new statusmon_pw_text
                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,"Only Admins can use the Status Monitor, sorry")
                        return PLUGIN_HANDLED
                }else{
                        if(show_status == 0) {
       
                                show_status = 1
               
                                client_cmd(id,"spk ^"status screen activated^"")
                                client_print(id,print_chat,"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 = 0

                                client_cmd(id,"spk ^"status screen deactivated^"")
                                client_print(id,print_chat,"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) {
                        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
                        new nick
                        new ip
                        new cmax = get_maxplayers()
                        new players = get_playersnum()
                        new slots = cmax-players
                        new Players
                        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
        read_args(said,31)

        if (equali(said,"^"/status^"") || equali(said,"^"status^""))
                statusmonitor(id,level,cid)
        return PLUGIN_CONTINUE
}

我是新手 发表于 2009-4-2 10:46:15

发个图看看啊

y543685085 发表于 2009-4-2 15:00:41

效果?......

shote 发表于 2009-4-2 16:29:27

图。。。。。。。。。。

火飞寒 发表于 2009-4-2 18:01:20

没图等于白发~拿钱走人~

野狼wolf 发表于 2009-4-2 19:03:10

没有这个插件的效果图吗?

xiao69 发表于 2009-4-3 22:59:05

没图没效果,我去试试玩玩!!

qq8992679 发表于 2011-1-2 10:31:51

反正不用钱。玩玩看!

snooper 发表于 2011-1-2 15:28:36

无图啊~~~:(

20061234 发表于 2011-1-2 16:23:08

发个图看看啊
页: [1] 2
查看完整版本: 新版排名