|
楼主 |
发表于 2012-6-3 21:52:34
|
显示全部楼层
来自 中国–江苏–苏州
本帖最后由 lili2009 于 2012-6-3 23:39 编辑
请高手看下!哪里出错。
#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[16]
read_data(2,team,15)
AddTag(id,team)
}
public AddTag(id,team[])
{
new temp[6],name[32],tag[32]
get_user_info(id,"name",name,31)
copy(temp,5,name)
if(equali(team,"CT"))
{
if(equal(temp,"[CHM]"))
{
return;
}else if(contain(temp,"[MOD]")!=-1){
copy(temp,5,name);
if(equal(temp,"[MOD]"))
format(tag,31,"[CHM] %s",name[6])
}else{
format(tag,31,"[CHM] %s",name)
}
set_user_info(id,"name",tag)
}
if(equali(team,"TERRORIST"))
{
if(equal(temp,"[CHM]"))
{
format(tag,31,"[MOD] %s",name[6])
}else if(contain(temp,"[MOD]")!=-1)
{
copy(temp,5,name)
if(equal(temp,"[MOD]"))
return;
}else{
format(tag,31,"[MOD] %s",name);
}
set_user_info(id,"name",tag)
}
}
public client_infochanged(id)
{
if(!is_user_connected(id))
return PLUGIN_CONTINUE
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);
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
} |
|