搜索
查看: 2214|回复: 2

牛牛问你个key_bind代码的事

[复制链接]
发表于 2005-9-26 15:56:29 | 显示全部楼层 |阅读模式 来自 中国–广东–深圳–南山区
我用了你写的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[MAX_BINDS][16]
new bind_cmd[MAX_BINDS][32]
new bind_usage[MAX_BINDS][128]
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[64]
        get_configsdir(configsDir, 63)
        format(configsDir, 63, "%s/key_bind.ini", configsDir)
        loadSettings(configsDir)
}

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

        while ( g_kNum < MAX_BINDS && read_file(szFilename,pos++,temp,255,a) ) {         
        if ( temp[0] == ';' )
                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[g_kNum],bind_cmd[g_kNum] )
        ++g_kNum
        }
        server_print("[AMXX] Load %d key to bind for client.",g_kNum )
        return 1
}

public client_putinserver(id){
           new ids[2]
           ids[0]=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[0]
        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[0]
        client_print(id,print_chat,"* ″ㄧ浣缁瀹浜涓浜? 璇锋 Y 杈 /keyhelp ユョ?)         //绀虹╁惰?help
}

public client_help(id) {  //褰╁惰/keyhelp剧ず瀹
        new pos = 0 ,temp[512]
          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[pos],511-pos,"欢迎来到该服务器, 朋友!^n服务器为了使你玩的方便, 绑定了一些有用的键位, 功能如下:^n")
        for (new i=0; i<g_kNum; ++i)
                  pos += format(temp[pos],511-pos,"按键 %s 为 %s ^n",bind_key,bind_usage)
        pos += format(temp[pos],511-pos,"好了! 祝你在游戏里玩得愉快!^n")
          format(temp[pos],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[MAX_BINDS][16]
new bind_cmd[MAX_BINDS][32]
new bind_usage[MAX_BINDS][128]
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[64]
get_configsdir(configsDir, 63)
format(configsDir, 63, "%s/key_bind.ini", configsDir)
loadSettings(configsDir)
}

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

while ( g_kNum < MAX_BINDS && read_file(szFilename,pos++,temp,255,a) ) {
if ( temp[0] == ';' )
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[g_kNum],bind_cmd[g_kNum] )
++g_kNum
}
server_print("[AMXX] Load %d key to bind for client.",g_kNum )
return 1
}

public client_putinserver(id){
new ids[2]
ids[0]=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[0]
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[0]
client_print(id,print_chat,"* 服务器给你绑定了一些按钿 请按 Y 输入 /keyhelp 来查皿) //提示玩家whelp
}

public client_help(id) { //当玩家说/keyhelp后显示的内容
new pos = 0 ,temp[512]
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[pos],511-pos,"???4μ??÷? ??!^n・?a???Φμ??±?°????Щ??μ??|???:^n")
for (new i=0; i<g_kNum; ++i)
pos += format(temp[pos],511-pos,"°′??a %s ^n",bind_key,bind_usage)
pos += format(temp[pos],511-pos,"oā ?????oΦμē倬!^n")
format(temp[pos],511-pos,"</pre></body></html>")
show_motd(id,temp,"服务器按键帮刿)
}

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

使用道具 举报

 楼主| 发表于 2005-9-29 05:05:49 | 显示全部楼层 来自 中国–广东–深圳–南山区

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

收到 :super:
回复

使用道具 举报

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

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