|
本帖最后由 [Grief.QQ] 于 2009-1-26 20:01 编辑
语音乱码,是因为记分板用UTF8处理,语音标签用ANSI处理,确切的说,是系统的默认编码处理。(by AXOT)
那么,最笨的办法就是在语音之前用ANSI改名,然后再改回UTF8。
既然插件不能追踪到语音事件,那么就只有替客户端绑定按键来解决了。
唯一的好处就是可以解决乱码,缺点很多,需要绑定某个按键,而且客户端不能决定,如果你有登录器,不妨在登录器中增加设置语音键,附上测试代码,至于ANSI和utf8之间的转换我就不说了。
环境:使用 AXOT 破解的 SWDS.DLL
#include <amxmodx>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "AXOT & [Grief.QQ]"
new asi_name[50]
new utf_name[50]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("+mic","micON")
register_clcmd("-mic","micOFF")
format(asi_name,49,"^xD6^xD0^xCE^xC4^xB2^xE2^xCA^xD4")
format(utf_name,49,"^xE4^xB8^xAD^xE6^x96^x87^xE6^xB5^x8B^xE8^xAF^x95")
}
public client_connect(id)
{
client_cmd(id,"bind i ^"+voicerecord;+mic^"")
client_cmd(id,"voice_loopback 1")
set_user_info(id,"name",utf_name)
}
public client_putinserver(id)
{
set_user_info(id,"name",utf_name)
}
public micON(id)
{
client_cmd(id,"bind i ^"+mic^"")
set_user_info(id,"name",asi_name)
client_cmd(id,"+voicerecord")
set_task(0.1,"ChangeName1",id,_,_,_,_)
set_task(0.3,"ChangeName",id,_,_,_,_)
return PLUGIN_HANDLED
}
public ChangeName1(id)
{
set_user_info(id,"name",asi_name)
}
public ChangeName(id)
{
set_user_info(id,"name",utf_name)
}
public micOFF(id)
{
client_cmd(id,"-voicerecord")
client_cmd(id,"bind i ^"+voicerecord;+mic^"")
return PLUGIN_HANDLED
}
这是测试代码,如果你用登录器解决的,可以不必这么麻烦。 |
|