AE86 发表于 2005-9-26 15:56:29

牛牛问你个key_bind代码的事

我用了你写的key_bind插件,我用UE打开有些是乱码的,请问要用什么打开才不乱码呢,我想做些修改,这个插件是不是有些键绑不了,因为我把F1 -- F12都绑了,在游戏了输入/keyhelp里面只有F1 - F3有用。 :burn:
/*
*        AMX MOD X
*
*        auth:nwb13
*        last edit:2004.11.9
*
*/


#include <amxmodx>
#include <amxmisc>


#define MAX_BINDS 10//缁瀹伴?

new bind_key
new bind_cmd
new bind_usage
new g_kNum

public plugin_init() {
        register_plugin( "client key bind", "0.31", "nwb13" )
        register_clcmd("say /keyhelp","client_help",0,"- displays server help")//╁惰?keyhelp寮甯
        new configsDir
        get_configsdir(configsDir, 63)
        format(configsDir, 63, "%s/key_bind.ini", configsDir)
        loadSettings(configsDir)
}

loadSettings(szFilename[]) {
        if (!file_exists(szFilename))
                return 0
        new temp
        new a, pos = 0

        while ( g_kNum < MAX_BINDS && read_file(szFilename,pos++,temp,255,a) ) {         
        if ( temp == ';' )
                continue
        if (parse(temp, bind_key[ g_kNum ] ,15, bind_cmd[ g_kNum ], 31, bind_usage[ g_kNum ],127 )<2)
                continue
        //server_print("key: %s ;cmd: %s",bind_key,bind_cmd )
        ++g_kNum
        }
        server_print(" Load %d key to bind for client.",g_kNum )
        return 1
}

public client_putinserver(id){
           new ids
           ids=id
           set_task(5.0,"bind_keys",id,ids,2)
        set_task(20.0,"help_note",id,ids,2)
}

public bind_keys(ids[]){
        new id = ids
        for (new i=0; i<g_kNum; ++i){
                    client_cmd(id,"bind ^"%s^" ^"%s^"",bind_key,bind_cmd)
                    //client_print(id,print_chat,"bind ^"%s^" ^"%s^"",bind_key,bind_cmd)
           }
}

public help_note(ids[]){
        new id =ids
        client_print(id,print_chat,"* ″ㄧ浣缁瀹浜涓浜? 璇锋 Y 杈 /keyhelp ユョ?)         //绀虹╁惰?help
}

public client_help(id) {//褰╁惰/keyhelp剧ず瀹
        new pos = 0 ,temp
        pos = format(temp,511,"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>")
        pos += format(temp,511-pos,"欢迎来到该服务器, 朋友!^n服务器为了使你玩的方便, 绑定了一些有用的键位, 功能如下:^n")
        for (new i=0; i<g_kNum; ++i)
                pos += format(temp,511-pos,"按键 %s 为 %s ^n",bind_key,bind_usage)
        pos += format(temp,511-pos,"好了! 祝你在游戏里玩得愉快!^n")
        format(temp,511-pos,"</pre></body></html>")
        show_motd(id,temp,"″ㄦ甯?)
}

抓外挂出身 发表于 2005-9-28 20:15:33

回复: 牛牛问你个key_bind代码的事

/*
* AMX MOD X
*
* auth:nwb13
* last edit:2004.11.9
*
*/


#include <amxmodx>
#include <amxmisc>


#define MAX_BINDS 10 //绑定按键的数酿

new bind_key
new bind_cmd
new bind_usage
new g_kNum

public plugin_init() {
register_plugin( "client key bind", "0.31", "nwb13" )
register_clcmd("say /keyhelp","client_help",0,"- displays server help") //玩家wkeyhelp开帮助
new configsDir
get_configsdir(configsDir, 63)
format(configsDir, 63, "%s/key_bind.ini", configsDir)
loadSettings(configsDir)
}

loadSettings(szFilename[]) {
if (!file_exists(szFilename))
return 0
new temp
new a, pos = 0

while ( g_kNum < MAX_BINDS && read_file(szFilename,pos++,temp,255,a) ) {
if ( temp == ';' )
continue
if (parse(temp, bind_key[ g_kNum ] ,15, bind_cmd[ g_kNum ], 31, bind_usage[ g_kNum ],127 )<2)
continue
//server_print("key: %s ;cmd: %s",bind_key,bind_cmd )
++g_kNum
}
server_print(" Load %d key to bind for client.",g_kNum )
return 1
}

public client_putinserver(id){
new ids
ids=id
set_task(5.0,"bind_keys",id,ids,2)
set_task(20.0,"help_note",id,ids,2)
}

public bind_keys(ids[]){
new id = ids
for (new i=0; i<g_kNum; ++i){
client_cmd(id,"bind ^"%s^" ^"%s^"",bind_key,bind_cmd)
//client_print(id,print_chat,"bind ^"%s^" ^"%s^"",bind_key,bind_cmd)
}
}

public help_note(ids[]){
new id =ids
client_print(id,print_chat,"* 服务器给你绑定了一些按钿 请按 Y 输入 /keyhelp 来查皿) //提示玩家whelp
}

public client_help(id) { //当玩家说/keyhelp后显示的内容
new pos = 0 ,temp
pos = format(temp,511,"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>")
pos += format(temp,511-pos,"???4μ??÷? ??!^n・?a???Φμ??±?°????Щ??μ??|???:^n")
for (new i=0; i<g_kNum; ++i)
pos += format(temp,511-pos,"°′??a %s ^n",bind_key,bind_usage)
pos += format(temp,511-pos,"oā ?????oΦμē倬!^n")
format(temp,511-pos,"</pre></body></html>")
show_motd(id,temp,"服务器按键帮刿)
}

编码转换为ASCII 你就能看到正常的内容了

AE86 发表于 2005-9-29 05:05:49

回复: 牛牛问你个key_bind代码的事

收到 :super:
页: [1]
查看完整版本: 牛牛问你个key_bind代码的事