eason39 发表于 2009-2-26 05:10:02

high_ping_kicker.sma 高ping踢出后的提示,如何修改?

本帖最后由 eason39 于 2009-2-26 05:12 编辑

一般人都不知道按控制台出来看信息,如果做到踢出后 有对话框显示,比如"你以被服务器踢出,原因ping值太高!这样。#include <amxmodx>

new g_Ping
new g_Samples
new pamx_hpk_ping
new pamx_hpk_check
new pamx_hpk_tests
new pamx_hpk_delay

public plugin_init()
{
        register_plugin("High Ping Kicker","1.0","datang")
        register_dictionary("high_ping_kicker.txt")
        pamx_hpk_ping = register_cvar("amx_hpk_ping","200")
        pamx_hpk_check = register_cvar("amx_hpk_check","5")
        pamx_hpk_tests = register_cvar("amx_hpk_tests","5")
        pamx_hpk_delay = register_cvar("amx_hpk_delay","60")

        if ( get_pcvar_num( pamx_hpk_check ) < 5 ) set_pcvar_num( pamx_hpk_check , 5 )
        if ( get_pcvar_num( pamx_hpk_tests ) < 3 ) set_pcvar_num( pamx_hpk_tests , 3 )
}

public client_disconnect(id)
        remove_task( id )

public client_putinserver(id)
{   
        g_Ping = 0
        g_Samples = 0

        if ( !is_user_bot(id) )
        {
                new param
                param = id
                set_task( 10.0 , "showWarn" , id , param , 1 )
   
                if (get_pcvar_num(pamx_hpk_delay) != 0) {
                        set_task( float(get_pcvar_num(pamx_hpk_delay)), "taskSetting", id, param , 1)
                }
                else {          
                        set_task( float(get_pcvar_num( pamx_hpk_check )) , "checkPing" , id , param , 1 , "b" )
                }       
        }
}

public showWarn(param[]) {
        client_print( param ,print_chat,"* %L",LANG_SERVER,"PING", get_pcvar_num( pamx_hpk_ping ) )
        console_print( param,"* %L",LANG_SERVER,"PING", get_pcvar_num( pamx_hpk_ping ) )
}

public taskSetting(param[]) {
        set_task( float(get_pcvar_num( pamx_hpk_check )) , "checkPing" , param , param , 1 , "b" )
}

kickPlayer( id )
{
        new name,authid
        new userid = get_user_userid(id)
        get_user_name(id,name,31)
        get_user_authid(id,authid,31)
        client_print(0,print_chat,"* %L", id, "KICKED", name)
        log_amx("^"%s<%d><%s><>^" has been kicked due to high ping.", name, userid, authid)
        client_cmd(id, "echo ^"* %L^"", id, "HPK")
        client_cmd(id, "disconnect")//Has no effects in CS1.5
        server_cmd("kick #%d", userid)//So kicked
        remove_task(id)
}

public checkPing(param[])
{
        new id = param[ 0 ]
        if ( get_user_flags(id) & ADMIN_IMMUNITY || get_user_flags(id) & ADMIN_RESERVATION ) return
        new p, l
        get_user_ping( id , p , l )
        g_Ping[ id ] += p
        ++g_Samples[ id ]
        if ( (g_Samples[ id ] >= get_pcvar_num( pamx_hpk_tests )) && (g_Ping / g_Samples > get_pcvar_num( pamx_hpk_ping )) )   
                kickPlayer(id)
}

sakulekingz 发表于 2009-2-26 09:34:33

amxmodx\data\lang\High_Ping_Kicker.txt

lhtkick 发表于 2009-2-26 09:40:50

amxmodx\data\lang\High_Ping_Kicker.txt

eason39 发表于 2009-2-26 19:41:33

amxmodx\data\lang\High_Ping_Kicker.txt
sakulekingz 发表于 2009-2-26 09:34 http://www.dt-club.net/forum/images/common/back.gif
我都知道在这里配置,这些都知道,关键是 被踢出的玩家要在console里才能看到这些信息,如果不按出来 是看不到的我的意思是说 就像OP把玩家踢出有个对话框提示,别像这个插件一样要按控制台出来才看到踢出信息

心静如水 发表于 2009-2-26 23:53:33

client_print(0,print_chat,"*【公告】%s 因为Ping超过 80 而被踢",Name)

eason39 发表于 2009-2-27 00:54:45

client_print(0,print_chat,"*【公告】%s 因为Ping超过 80 而被踢",Name)
心静如水 发表于 2009-2-26 23:53 http://www.dt-club.net/forum/images/common/back.gif
老大们 不知道是不是我表达能力有问题,是指的是被踢出的玩家提示,让被踢出的人知道自己的被踢的原因而不是服务器里的玩家。

心静如水 发表于 2009-2-27 08:40:33

server_cmd("kick #%d ^"你的Ping太高被踢出^"",get_user_userid(id))

eason39 发表于 2009-2-27 09:12:05

server_cmd("kick #%d ^"你的Ping太高被踢出^"",get_user_userid(id))
心静如水 发表于 2009-2-27 08:40 http://www.dt-club.net/forum/images/common/back.gif

谢谢 水哥我去试下

eason39 发表于 2009-2-27 09:42:32

水哥还是不行啊被踢玩家只能按控制台出来才看得到被踢出原因。。。

Rulzy 发表于 2009-2-27 21:08:28

把这一行:
server_cmd("kick #%d", userid)//So kicked
修改成:
server_cmd("kick #%d ^"%L^"", userid, id, "HPK")//So kicked

注意,踢出时附带附加信息不适用于CS1.5。
页: [1] 2
查看完整版本: high_ping_kicker.sma 高ping踢出后的提示,如何修改?