搜索
查看: 15086|回复: 34

求类似UT、TEAMSPEAK工具的AMXX插件

[复制链接]
发表于 2007-9-12 12:26:14 | 显示全部楼层 |阅读模式 来自 中国–陕西–西安
希望能有一个这样的插件.

队友之间,无论死活,都可以按通话键,比如K键去说话,而且一直可以听见本方的通话。

我在论坛上搜索了一个源码,希望大家能帮助我改成上面的功能。

源码实现的功能如下。
=========================================================
规则如下:
1、活着的时候,队友可以相互听话。
2、牺牲后,可以听到所有人的对话,但牺牲的玩家说话,活着的玩家听不到(包括队友)
增加两个控制台命令:
amx_mute amx_unmute 后面跟人的名字,如果有人的麦太吵得话,我们可以mute他,那他就只能听不能说了。
代码很短,不发附件了,请自行编译。
#include <amxmodx>
#include <engine>
#include <cstrike>
#include <fun>
#include <amxmisc>
/*new g_teamsNames[2][] = {
"TERRORIST",
"CT"
}*/
/*Voice Comm Control
Control dead player can voice comm each other, but alive player can not hear them.
*/
public plugin_init(){
register_plugin("Voice Comm Control","0.0.1","Zhao")
register_event("ResetHUD", "eventResetHud", "be")
register_event("DeathMsg","eDeathMsg","a")
register_concmd("amx_mute","amx_mute_player",ADMIN_VOTE,"playername --Mute players Microphone")
register_concmd("amx_unmute","amx_mute_player",ADMIN_VOTE,"playername --Unmute player's Microphone")
set_task(15.0,"alltalkoff")
}
public alltalkoff(){
set_cvar_num("sv_alltalk",0)
}
public amx_mute_player(id,level,cid){
new playername[33]
if (!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED
//new argc = read_argc()
new cmdname[33]
read_argv(0,cmdname,32)
read_argv(1,playername,32)
new player = cmd_target(id,playername,1)
if (!player) return PLUGIN_HANDLED
new imname[32],name2[32]
get_user_name(player,imname,31)
get_user_name(id,name2,31)
if(equal(cmdname,"amx_mute")){
set_speak(player,SPEAK_MUTED)
console_print(id,"%s is Muted",imname)
log_amx("Mute:%s Muted %s microphone",name2,imname)
}
else{
set_speak(player,SPEAK_NORMAL)
console_print(id,"%s is Unmuted",imname)
log_amx("Mute:%s unmuted %s microphone",name2,imname)
}
return PLUGIN_HANDLED
}
public client_putinserver(id){
set_speak(id,SPEAK_LISTENALL)
}
public eventResetHud(id){
new clmsg[513]
set_speak(id,SPEAK_NORMAL)
format(clmsg,512,"^x04[聊天控制]^x03现在语音通话被限制在队友之间")
message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, id)
write_byte(id)
write_string(clmsg)
message_end()
}
public eDeathMsg(){
new victim=read_data(2)
new clmsg[513]
set_speak(victim,SPEAK_LISTENALL)
remove_voice_from_alive(victim)
format(clmsg,512,"^x04[聊天控制]^x01牺牲了,可以听所有玩家语音通话,但活的队友听不到你的声音")
message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, victim)
write_byte(victim)
write_string(clmsg)
message_end()
}
public remove_voice_from_alive(victim){
new players[32],playerscount
get_players(players,playerscount,"a")
for(new i=0;i<playerscount;i++){
set_client_listen(players,victim,0)
}
}

还请大家帮忙。。。。。。
发表于 2007-9-12 12:49:56 | 显示全部楼层 来自 中国–浙江–嘉兴–海宁市

回复: 求类似UT、TEAMSPEAK工具的AMXX插件

1、活着的时候,队友可以相互听话。
2、牺牲后,可以听到所有人的对话,但牺牲的玩家说话,活着的玩家听不到(包括队友)
增加两个控制台命令:

这两个功能 的插件好像以前有的啊!

amx_mute amx_unmute 后面跟人的名字,如果有人的麦太吵得话,我们可以mute他,那他就只能听不能说了。

这个功能不错!
回复

使用道具 举报

发表于 2007-9-12 12:51:36 | 显示全部楼层 来自 中国–浙江–嘉兴–海宁市

回复: 求类似UT、TEAMSPEAK工具的AMXX插件

amx_mute amx_unmute
这样控制有点麻烦,建议做成菜单!
回复

使用道具 举报

 楼主| 发表于 2007-9-13 10:12:10 | 显示全部楼层 来自 中国–陕西–西安

回复: 求类似UT、TEAMSPEAK工具的AMXX插件

我想要的是,牺牲的玩家说话,活着的队友和死去的可以听到.
回复

使用道具 举报

发表于 2007-9-13 19:31:30 | 显示全部楼层 来自 中国–福建–漳州

回复: 求类似UT、TEAMSPEAK工具的AMXX插件

是要这样吗:死的玩家说话,活着的队友和所有死的玩家都可以听得到?
那活着的玩家说话,哪些人可以听到?是所有队友吗?

简单的修改是无法达到这个功能的。其实那样不好,死的人说话,最好不要让活着的人听到,否则会严重影响活着的玩家游戏的,吵得都听不到脚步声和枪声了。原来的规则就很好。
回复

使用道具 举报

发表于 2007-9-13 21:03:38 | 显示全部楼层 来自 中国–广东–佛山

回复: 求类似UT、TEAMSPEAK工具的AMXX插件

可以参考这个,ADMIN_KICK权限有LZ所说的功能.这个比所有人合理很多.
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4. #include <fun>
  5. #include <cstrike>
  6. new g_adminpa[33] = {false,...}
  7. new g_previousspeak [33]
  8. new players[32]
  9. new pnum
  10. new g_pa_on = true
  11. public plugin_init() {
  12.     register_plugin("Dead Chat w/ Admin PA","2.0","SuicideDog")
  13.     register_clcmd("admin_pa","admin_pa",ADMIN_KICK,"- Turns on/off PA system for that admin")  
  14.     register_event("DeathMsg","death","a")
  15.     register_event("ResetHUD","alive","b")
  16.     register_cvar("amx_deadchat","1") // Turns off/on Deadchat (Defualt = on)
  17.     register_cvar("amx_admin_pa" ,"1") // Turns off/on Admin PA (Defualt = on)
  18.     register_cvar("amx_admin_pa_mute" ,"1") // Mute all players while admin pa (Defualt = on)
  19. }
  20. public admin_pa(id,level,cid){
  21. if ( get_cvar_num("amx_admin_pa")!=1 ) return PLUGIN_HANDLED
  22. if (!cmd_access(id,level,cid,1))return PLUGIN_HANDLED
  23. if (!g_adminpa[id]){
  24.   g_adminpa[id] = true
  25.   set_speak(id, SPEAK_LISTENALL+SPEAK_ALL)
  26.   client_print(id,print_center,"PA: ON") // let the user know whats going on
  27.   if ( get_cvar_num("amx_admin_pa_mute")==1){ // Mute all players if needed
  28.    get_players(players, pnum)
  29.    for (new i = 0; i < pnum; i++) {
  30.    //Do not mute other admins if they have Admin PA on, or any players already muted
  31.    if (is_user_connected(players[i]) && get_speak(players[i]) != SPEAK_MUTED && !g_adminpa[players[i]]){
  32.     g_previousspeak[i] = get_speak(players[i])
  33.     set_speak(players[i], SPEAK_MUTED)
  34.     client_print(players[i],print_center,"You have been muted.")
  35.     }
  36.    }
  37.   }
  38. }
  39. else{
  40.   g_adminpa[id] = false
  41.   get_players(players, pnum)
  42.   for (new i = 0; i < pnum; i++) {
  43.    if (g_adminpa[players[i]]){
  44.     g_pa_on = true // check to see if any other the other admins have the pa on
  45.    }
  46.    else{
  47.     g_pa_on = false
  48.    }
  49.   }
  50.   if (is_user_alive(id)){
  51.    if (is_user_connected(id)){
  52.     if (g_pa_on && get_cvar_num("amx_admin_pa_mute")==1){
  53.      set_speak(id, SPEAK_MUTED)
  54.      client_print(id,print_center,"PA Off: You have been muted.")
  55.     }
  56.     else{
  57.      set_speak(id, SPEAK_NORMAL)
  58.      client_print(id,print_center,"PA Off: You have been unmuted and can voice chat normally")
  59.     }
  60.    }
  61.   }
  62.   else{
  63.    if (is_user_connected(id)){
  64.     if (g_pa_on && get_cvar_num("amx_admin_pa_mute")==1){
  65.      set_speak(id, SPEAK_MUTED)
  66.      client_print(id,print_center,"PA Off: You have been muted.")
  67.     }
  68.     else{
  69.      set_speak(id, SPEAK_LISTENALL)
  70.      client_print(id,print_center,"PA Off: You have been unmuted and can voice chat normally")
  71.     }
  72.    }
  73.   }
  74.   if ( get_cvar_num("amx_admin_pa_mute")==1 && !g_pa_on){ // Handle unmutting
  75.    get_players(players, pnum)
  76.    for (new i = 0; i < pnum; i++) {
  77.     //Set users back to previous voice setting. Admin_gag compliant
  78.     if (is_user_alive(players[i])){
  79.      if (is_user_connected(players[i]) && g_previousspeak[players[i]] != SPEAK_MUTED && players[i] != id && !g_adminpa[players[i]]){
  80.       set_speak(players[i], SPEAK_NORMAL)
  81.       client_print(players[i],print_center,"You have been unmuted and can voice chat normally")
  82.      }
  83.     }
  84.     else{
  85.      if (is_user_connected(id) && g_previousspeak[players[i]] != SPEAK_MUTED && players[i] != id && !g_adminpa[players[i]]){
  86.       set_speak(players[i], SPEAK_LISTENALL)
  87.       client_print(players[i],print_center,"You are unmuted now, you can voice chat with other dead players")
  88.      }
  89.     }
  90.    }
  91.   }
  92. }
  93. return PLUGIN_HANDLED
  94. }
  95. public death(){
  96. if ( get_cvar_num("amx_deadchat")!=1 ) return PLUGIN_CONTINUE
  97. new id = read_data(2)
  98. if (g_adminpa[id]) return PLUGIN_HANDLED
  99. if (is_user_connected(id) && get_speak(id) != SPEAK_MUTED ) set_speak(id, SPEAK_LISTENALL)
  100. client_print(id,print_center,"You are dead now, you can voice chat with other dead players")
  101. return PLUGIN_HANDLED
  102. }
  103. public alive(id){
  104. if (g_adminpa[id]) return PLUGIN_HANDLED
  105. if ( get_cvar_num("amx_deadchat")!=1 ) return PLUGIN_CONTINUE
  106. if (is_user_connected(id) && get_speak(id) != SPEAK_MUTED ) set_speak(id, SPEAK_NORMAL)
  107. return PLUGIN_CONTINUE
  108. }
复制代码
也就是说要将amx_mute playername及amx_unmute playername功能集成到上面的这段代码.Rulzy老大帮忙改下.amx_mute playername这个功能实在太好了.期待ing..........
回复

使用道具 举报

 楼主| 发表于 2007-9-13 22:14:05 | 显示全部楼层 来自 中国–陕西–西安

回复: 求类似UT、TEAMSPEAK工具的AMXX插件

Rulzy vbmenu_register("postmenu_278920", true);  ,你终于来了....哈哈

我想要的是

假如当CT   死人都可以说话给活人  活人也可以说话给死人  前提是必须同一队伍.

T也一样...

能做吗???
回复

使用道具 举报

发表于 2007-9-13 22:43:53 | 显示全部楼层 来自 中国–福建–漳州

回复: 求类似UT、TEAMSPEAK工具的AMXX插件

Post by gearfox
Rulzy vbmenu_register("postmenu_278920", true); ,你终于来了....哈哈

我想要的是

假如当CT 死人都可以说话给活人 活人也可以说话给死人 前提是必须同一队伍.

T也一样...

能做吗???
sv_alltalk为0时,如果不使用任何控制语音的插件,默认是不是队友之间,不管死活,都可以通话的?好像是这样的吧,有点忘了,嘿嘿。
回复

使用道具 举报

发表于 2007-9-14 01:12:35 | 显示全部楼层 来自 中国–上海–上海–浦东新区

回复: 求类似UT、TEAMSPEAK工具的AMXX插件

Post by Rulzy
sv_alltalk为0时,如果不使用任何控制语音的插件,默认是不是队友之间,不管死活,都可以通话的?好像是这样的吧,有点忘了,嘿嘿。


不是默认情况不加插件 活着队友能和所有队友通话   死的队友只能和死的队友通话 同时 死的队友能听到活的队友说话
回复

使用道具 举报

发表于 2007-9-14 01:54:56 | 显示全部楼层 来自 中国–广东–佛山–禅城区

回复: 求类似UT、TEAMSPEAK工具的AMXX插件

Post by gearfox
Rulzy vbmenu_register("postmenu_278920", true); ,你终于来了....哈哈

我想要的是

假如当CT 死人都可以说话给活人 活人也可以说话给死人 前提是必须同一队伍.

T也一样...

能做吗???
代码在6楼,将ADMIN_KICK改为ADMIN_ALL
  1. SPEAK_LISTENALL+SPEAK_ALL
复制代码
改为队伍正常通话应该就可以实现了吧.
同理,你发的代码中
  1. set_speak(victim,SPEAK_LISTENALL)
复制代码
改为
  1. [color=red]set_speak(victim,SPEAK_NORMAL)[/color]
复制代码
也就是无论死活都将通话设为队伍正常模式.
菜鸟一个,不知道说得对不对.:embarrass
另外,经测试,一楼的代码中
amx_mute playername命令执行成功后无任何效果,amx_mute #ID也无效,显示muted了,但玩家说的话依然可以听到,求解中...........
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表