回复: 怎么让玩家的名字前缀战队标签?
public join_team() //去掉id
{
new log,name,tag,temp,team,userid,authid
read_logdata(log,63)
parse_loguser(log,name,31,userid,authid,31,team,15)
copy(temp,6,name)
new id=get_user_index(name) //增加行
回复: 怎么让玩家的名字前缀战队标签?
L 02/03/2008 - 04:23:05: Invalid player id 0L 02/03/2008 - 04:23:05: Displaying debug trace (plugin "flag_name.amxx")
L 02/03/2008 - 04:23:05: Run time error 10: native error (native "set_user_info")
L 02/03/2008 - 04:23:05: flag_name.sma::join_team (line 45)
L 02/03/2008 - 04:23:06: Invalid player id 0
L 02/03/2008 - 04:23:06: Displaying debug trace (plugin "flag_name.amxx")
L 02/03/2008 - 04:23:06: Run time error 10: native error (native "set_user_info")
L 02/03/2008 - 04:23:06: flag_name.sma::join_team (line 45)
无奈咯~ 还是不行啊.
回复: 怎么让玩家的名字前缀战队标签?
#include <amxmodx>
#include <amxmisc>
#define PLUGIN_NAME "New Plug-In"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "zwfgdlc"
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
register_logevent("join_team",3,"1=joined team","2=CT","2=TERRORIST")
}
public join_team()
{
new log,name,tag,temp,team
read_logargv(0,log,63)
read_logargv(2,team,15)
parse_loguser(log,name,31)
copy(temp,6,name)
new id=get_user_index(name)
if(equal(team,"CT"))
{
if(equal(temp,""))
{
return;
}else if(contain(temp,"")!=-1)
{
copy(temp,5,name);
if(equal(temp,""))
format(tag,31,"%s",name);
}
else
{
format(tag,31,"%s",name);
}
}else{
if(equal(temp,""))
{
format(tag,31,"%s",name);
}else if(contain(temp,"")!=-1)
{
copy(temp,5,name)
if(equal(temp,""))
return;
}else{
format(tag,31,"%s",name);
}
}
set_user_info(id,"name",tag)
}
这个可以了
回复: 怎么让玩家的名字前缀战队标签?
你看了我前面发的那个游戏截图了吧?其实当时就是用bot来测试的,结果证明完全可以在bot的名字前加上“”字符,因此我觉得不像是bot的问题。回复: 怎么让玩家的名字前缀战队标签?
现在应该是可以了,我用BOT测试,在HLSW里看到有改名,,都有睡觉了,好冷喔!!!!:cold::embarrass
回复: 怎么让玩家的名字前缀战队标签?
呵呵~ 问题解决了,终于可以睡个安稳觉咯!再次感谢zwfgdlc楼主的热心帮助,祝君好梦!回复: 怎么让玩家的名字前缀战队标签?
发现个问题了,就是一旦玩家更换了名字,那么就没有前缀的字符了.在不使用禁止改名插件的情况下,怎么解决这个问题呢?回复: 怎么让玩家的名字前缀战队标签?
不知道有没效,自己试下吧#include <amxmodx>
#include <amxmisc>
#define PLUGIN_NAME "New Plug-In"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "zwfgdlc"
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
register_logevent("join_team",3,"1=joined team","2=CT","2=TERRORIST")
}
public join_team()
{
new log,name,team
read_logargv(0,log,63)
read_logargv(2,team,15)
parse_loguser(log,name,31)
new id=get_user_index(name)
AddTag(id,team);
}
public AddTag(id,team[])
{
new temp,name,tag
get_user_info(id,"name",name,31)
copy(temp,6,name)
if(equal(team,"CT"))
{
if(equal(temp,""))
{
return;
}else if(contain(temp,"")!=-1){
copy(temp,5,name);
if(equal(temp,""))
format(tag,31,"%s",name);
}else{
format(tag,31,"%s",name);
}
set_user_info(id,"name",tag)
}
if(equal(team,"TERRORIST"))
{
if(equal(temp,""))
{
format(tag,31,"%s",name);
}else if(contain(temp,"")!=-1){
copy(temp,5,name)
if(equal(temp,""))
return;
}else{
format(tag,31,"%s",name);
}
set_user_info(id,"name",tag)
}
}
public client_infochanged(id)
{
new oldname,newname,team
get_user_name(id,oldname,31)
get_user_info(id,"name",newname,31)
if(!equal(oldname,newname))
get_user_team(id,team,15);
AddTag(id,team)
}
回复: 怎么让玩家的名字前缀战队标签?
先谢谢zwfgdlc楼主!上面的问题解决了!又测试了两天,我觉得还是有两个地方需要完善:1. 比如我在当警察,名字是X-man,ranhou
回复: 怎么让玩家的名字前缀战队标签?
谢谢zwfgdlc楼主不厌其烦的耐心帮助!上面的问题已经解决了!又测试了两天,我发现还是有两个地方需要完善:1. 比如我在当警察,名字为X-man,阵亡后我换队伍当匪徒(或者自杀后换做匪徒),但这时我的名字却依然是X-man,直到下一局开始时名字才会变成X-man.因此能不能这样:玩家换队伍成功的瞬间,名字的前缀也立即会变成其相应队伍的标签,而不必等到下一局开始时才生效?
2. 还有一个问题就是:当服务器的人数不平衡时,我们知道一般过两局之后就会自动调整的.比如这时一个名字叫ABC的CT被服务器自动弹过去当T了(或者被OP强制弹过去当T了),我们可以发现他的名字依然会是ABC,而不是ABC,所以我觉得这里还需要继续完善一下.