玩家名字前缀战队标签插件的问题
玩家名字前缀战队标签插件(flag_name_new.amxx)的功能就是可以在玩家的名字前面加上一个标签,即让服务器里所有的CT玩家名字前都加上BLUE这个标签,让所有的T玩家名字前都加上RED这个标签。(呵呵,这样一来就比较符合标准的比赛形式了。)但我觉得还有两个地方需要完善:1. 比如我在当警察,名字为X-man,阵亡后我换队伍当匪徒(或者自杀后换做匪徒),但这时我的名字却依然是X-man,直到下一局开始时名字才会变成X-man.因此能不能改成这样:玩家换队伍之后,名字的前缀也立即会变成其相应队伍的标签,而不必等到下一局开始时才换上队伍标签?
2. 还有一个问题就是:当服务器的人数不平衡时,我们知道一般过两局之后就会自动调整的.比如这时一个名字叫ABC的CT被服务器自动弹过去当T了(或者被OP强制弹过去当T了),我们可以发现他的名字依然会是ABC,而不是ABC,所以我觉得这里还需要继续完善一下.
#include <amxmodx>
#include <amxmisc>
#define PLUGIN_NAME "Flag Name"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "zwfgdlc"
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
server_cmd("mp_limitteams 1")
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,5,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)
}
回复: 玩家名字前缀战队标签插件的问题
名字都是在下一局开始时才能正确地打上本队的标签。就是说换队后的这一局名字是不会改变的,要到下一局开始时才会改变。
回复: 玩家名字前缀战队标签插件的问题
试下这个#include <amxmodx>
#include <amxmisc>
#define PLUGIN_NAME "Flag Name"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "zwfgdlc"
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
server_cmd("mp_limitteams 1")
register_event("TeamInfo","join_team","a","2!UNASSIGNED","2!SPECTATOR")
}
public join_team()
{
new id=read_data(1)
new team
read_data(2,team,15)
AddTag(id,team);
client_print(id,print_console,"你已经加入了%s",team)
}
public AddTag(id,team[])
{
new temp,name,tag
get_user_info(id,"name",name,31)
copy(temp,5,name)
if(equali(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(equali(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)
{
if(!is_user_connected(id))
return PLUGIN_CONTINUE;
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);
if(!is_user_alive(id))
{
message_begin(MSG_BROADCAST, get_user_msgid("SayText"))
write_byte(id)
write_string("#Cstrike_Name_Change")
write_string(oldname)
write_string(newname)
message_end()
}
}
AddTag(id,team)
return PLUGIN_CONTINUE
}
回复: 玩家名字前缀战队标签插件的问题
恩,第二个问题解决了,玩家被弹过去平衡人数后,其名字都是在下一局开始时才能正确地打上本队的标签。至于第一个问题,算了,也可以啦,本来CS系统就是要求玩家改名后下一局才生效的,那就顺应它好了。谢谢zwfgdlc楼主!回复: 玩家名字前缀战队标签插件的问题
代码还有一个问题比如使用换队插件时 名字不会改变
页:
[1]