|
发表于 2007-5-25 00:59:29
|
显示全部楼层
来自 中国–福建–漳州
回复: Rulzy老大还有问题请教,请进,谢谢。
- register_logevent("team_join",3,"1=joined team","2=TERRORIST","2=CT","2=SPECTATOR")
-
-
- public team_join()
- {
- new user[128]
- read_logargv(0, user, 127)
- new name[32], oldteam[12]={0}
- parse_loguser(user, name, 31, _, _, _, oldteam, 11)
- new id = get_user_index(name)
-
- new newteam[16]
- read_logargv(2,newteam, 15)
- if(equal(newteam,"SPECTATOR")) //加入观察员
- {
- if(equal(oldteam, "TERRORIST")) //从T加入观察员
- {
- ....
- }else if(equal(oldteam, "CT")){ //从CT加入观察员
- ....
- }else{ //进入服务器就加入观察员
- ....
- }
- }else if(equal(newteam,"TERRORIST")){ //加入T队伍
- if(equal(oldteam,"SPECTATOR")){ //从观察员加入T
- ....
- }else if(equal(oldteam,"CT")){ //从CT加入T
- ....
- }else if(oldteam[0]==0){ //连接到服务器就加入T或CT
- ....
- }
- }else if(equal(newteam,"CT")){ //加入CT队伍
- if(equal(oldteam,"TERRORIST")){ //从T加入CT
- ....
- }else if(equal(oldteam,"SPECTATOR")){ //从观察员加入CT
- ....
- }else if(oldteam[0]==0){ //连接到服务器就加入CT
- ....
- }
- }
- }
复制代码 可以这样得到,但这只是得到,并不能阻止,要想阻止,用下面的方法:- register_menucmd(-2,(1<<0)|(1<<1)|(1<<4)|(1<<5),"team_select")
- register_menucmd(register_menuid("Team_Select", 1),(1<<0)|(1<<1)|(1<<4)|(1<<5),"team_select")
-
- public team_select(id, key){
- //这里的key对应选择队伍时的菜单项,但key值小1。
- //即key为0指选择菜单项1(选择T),key为1指选择菜单项2(选择CT),
- //即key为4指选择菜单项5(自动选择),key为5指选择菜单项6(选择观察员)
- //如果阻止,return PLUGIN_HANDLED;否则 return PLUGIN_CONTINUE
- }
-
- public client_command(id)
- {
- new command[32]
- read_argv(0, command, 31)
- if(equali(command, "jointeam"))
- {
- new num, snum[3]
- read_argv(1, snum, 2)
- num = str_to_num(snum)
- return team_select(id, num-1)
- }
- return PLUGIN_CONTINUE
- }
复制代码 |
|