搜索
查看: 1928|回复: 0

内网优先怎么去掉某某IP正在连接

[复制链接]
发表于 2007-7-8 12:37:27 | 显示全部楼层 |阅读模式 来自 中国–浙江–温州

怎么去掉那个点通提示和来自某某
#include <amxmod>

public client_connect(id){
        new userip[17]
        new ips[8]
        new name[33]
        new g_amx_netbarip[8]
        get_user_ip(id,userip,16,1)
        copy(ips,7,userip)
        get_cvar_string("amx_netbarip",g_amx_netbarip,7)
        get_user_name(id,name,32)

        if (equali(ips,g_amx_netbarip)){
                set_user_flags(id,read_flags("b"))
                client_print(0,print_chat,"*[AMX]LanPlayer: %s (%s)",name,userip)
                new maxplayers = get_maxplayers()
                new players = get_playersnum( 1 )
                new limit = maxplayers - 1
                if( players > limit ){
                kickhping()       
                }
                }else{
                client_print(0,print_chat,"*[AMX]NetPlayer: %s (%s)trying to connect...",name,userip)
                }
        //client_print(0,print_chat,"*test: %s |%s",ips,g_amx_netbarip)
        return PLUGIN_CONTINUE
}

kickhping() {
       
    new who = 0, ping, loss, worst = -1
    new maxplayers = get_maxplayers()
    for(new i = 1; i <= maxplayers; ++i) {
        if ( !is_user_connected(i) && !is_user_connecting(i) )
            continue // not used slot   
        if (get_user_flags(i)&ADMIN_RESERVATION)
            continue // has reservation, skip him
        get_user_ping(i,ping,loss) // get ping
        if ( ping > worst ) {
            worst = ping
            who = i
        }
    }
    if(who)
        if ( is_user_bot(who) )
            server_cmd("kick #%d", get_user_userid(who)  )
        else{
                client_cmd(who,"echo ^"Dropped due to high ping to free slot for an admin^";disconnect")
                client_print(0,print_chat,"*[AMX]Dropped due to high ping to free slot for an admin!")
                }
    return who
}

public plugin_init() {
   register_plugin("NetBar","0.2","YanOnline")
   register_cvar("amx_netbarip","192.168")
   return PLUGIN_CONTINUE
}
游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

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