|
我的目的是想玩家进服务器选择队伍后以及换名字的时候,各执行JoinMessage一次,但我按照以下方式编写的话,玩家一进入服务器,就会连续执行2次该函数,换名字的时候,只执行一次,请帮我看看,是哪里出了问题?谢谢了!
public client_connect(id){
g_JoinedTeam[id] = 0;
}
public EventJoinedTeam(){
new id=read_data(1);
if(( g_JoinedTeam[id] == 0) && (!is_user_bot(id))){
g_JoinedTeam[id]=1;
if(msg_hide != 0)
return PLUGIN_CONTINUE
if(is_user_bot(id) || is_user_hltv(id))
return PLUGIN_CONTINUE
set_task(1.0, "JoinMessage", id,"130524")
remove_task(130524)
}
return PLUGIN_CONTINUE
}
public client_infochanged(id)
{
new newname[32],oldname[32]
get_user_info(id, "name", newname,31)
get_name(id,oldname,31)
if (!equal(oldname,newname)){
set_task(1.0, "JoinMessage", id,"130525")
}
}
public JoinMessage(id){
......
new szMessage[512];
format( szMessage, 511, "^x01* 欢迎^x04新朋友^x01 [^x04%s^x01] 加油! ", name);
client_color(0,id,szMessage);
} |
|