|
发表于 2008-2-4 19:23:07
|
显示全部楼层
来自 中国–广东–惠州–惠城区
回复: 怎么让玩家的名字前缀战队标签?
不知道有没效,自己试下吧- #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[64],name[32],team[16]
- 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[6],name[32],tag[32]
- get_user_info(id,"name",name,31)
- copy(temp,6,name)
- if(equal(team,"CT"))
- {
- if(equal(temp,"[BLUE]"))
- {
- return;
- }else if(contain(temp,"[RED]")!=-1){
- copy(temp,5,name);
- if(equal(temp,"[RED]"))
- format(tag,31,"[BLUE]%s",name[6]);
- }else{
- format(tag,31,"[BLUE]%s",name);
- }
- set_user_info(id,"name",tag)
- }
- if(equal(team,"TERRORIST"))
- {
- if(equal(temp,"[BLUE]"))
- {
- format(tag,31,"[RED]%s",name[6]);
- }else if(contain(temp,"[RED]")!=-1){
- copy(temp,5,name)
- if(equal(temp,"[RED]"))
- return;
- }else{
- format(tag,31,"[RED]%s",name);
- }
- set_user_info(id,"name",tag)
- }
- }
- public client_infochanged(id)
- {
- new oldname[32],newname[32],team[16]
- 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)
- }
复制代码 |
|