gearfox 发表于 2007-9-12 12:26:14

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

希望能有一个这样的插件.

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

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

源码实现的功能如下。
=========================================================
规则如下:
1、活着的时候,队友可以相互听话。
2、牺牲后,可以听到所有人的对话,但牺牲的玩家说话,活着的玩家听不到(包括队友)
增加两个控制台命令:
amx_mute amx_unmute 后面跟人的名字,如果有人的麦太吵得话,我们可以mute他,那他就只能听不能说了。
代码很短,不发附件了,请自行编译。
#include <amxmodx>
#include <engine>
#include <cstrike>
#include <fun>
#include <amxmisc>
/*new g_teamsNames[] = {
"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
if (!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED
//new argc = read_argc()
new cmdname
read_argv(0,cmdname,32)
read_argv(1,playername,32)
new player = cmd_target(id,playername,1)
if (!player) return PLUGIN_HANDLED
new imname,name2
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
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
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,playerscount
get_players(players,playerscount,"a")
for(new i=0;i<playerscount;i++){
set_client_listen(players,victim,0)
}
}

还请大家帮忙。。。。。。

lu0007 发表于 2007-9-12 12:49:56

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

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

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

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

这个功能不错!

lu0007 发表于 2007-9-12 12:51:36

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

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

gearfox 发表于 2007-9-13 10:12:10

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

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

Rulzy 发表于 2007-9-13 19:31:30

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

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

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

ceoguang 发表于 2007-9-13 21:03:38

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

可以参考这个,ADMIN_KICK权限有LZ所说的功能.这个比所有人合理很多.#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>
#include <cstrike>
new g_adminpa = {false,...}
new g_previousspeak
new players
new pnum
new g_pa_on = true
public plugin_init() {
    register_plugin("Dead Chat w/ Admin PA","2.0","SuicideDog")
    register_clcmd("admin_pa","admin_pa",ADMIN_KICK,"- Turns on/off PA system for that admin")
    register_event("DeathMsg","death","a")
    register_event("ResetHUD","alive","b")
    register_cvar("amx_deadchat","1") // Turns off/on Deadchat (Defualt = on)
    register_cvar("amx_admin_pa" ,"1") // Turns off/on Admin PA (Defualt = on)
    register_cvar("amx_admin_pa_mute" ,"1") // Mute all players while admin pa (Defualt = on)
}
public admin_pa(id,level,cid){
if ( get_cvar_num("amx_admin_pa")!=1 ) return PLUGIN_HANDLED
if (!cmd_access(id,level,cid,1))return PLUGIN_HANDLED
if (!g_adminpa){
g_adminpa = true
set_speak(id, SPEAK_LISTENALL+SPEAK_ALL)
client_print(id,print_center,"PA: ON") // let the user know whats going on
if ( get_cvar_num("amx_admin_pa_mute")==1){ // Mute all players if needed
   get_players(players, pnum)
   for (new i = 0; i < pnum; i++) {
   //Do not mute other admins if they have Admin PA on, or any players already muted
   if (is_user_connected(players) && get_speak(players) != SPEAK_MUTED && !g_adminpa]){
    g_previousspeak = get_speak(players)
    set_speak(players, SPEAK_MUTED)
    client_print(players,print_center,"You have been muted.")
    }
   }
}
}
else{
g_adminpa = false
get_players(players, pnum)
for (new i = 0; i < pnum; i++) {
   if (g_adminpa]){
    g_pa_on = true // check to see if any other the other admins have the pa on
   }
   else{
    g_pa_on = false
   }
}
if (is_user_alive(id)){
   if (is_user_connected(id)){
    if (g_pa_on && get_cvar_num("amx_admin_pa_mute")==1){
   set_speak(id, SPEAK_MUTED)
   client_print(id,print_center,"PA Off: You have been muted.")
    }
    else{
   set_speak(id, SPEAK_NORMAL)
   client_print(id,print_center,"PA Off: You have been unmuted and can voice chat normally")
    }
   }
}
else{
   if (is_user_connected(id)){
    if (g_pa_on && get_cvar_num("amx_admin_pa_mute")==1){
   set_speak(id, SPEAK_MUTED)
   client_print(id,print_center,"PA Off: You have been muted.")
    }
    else{
   set_speak(id, SPEAK_LISTENALL)
   client_print(id,print_center,"PA Off: You have been unmuted and can voice chat normally")
    }
   }
}
if ( get_cvar_num("amx_admin_pa_mute")==1 && !g_pa_on){ // Handle unmutting
   get_players(players, pnum)
   for (new i = 0; i < pnum; i++) {
    //Set users back to previous voice setting. Admin_gag compliant
    if (is_user_alive(players)){
   if (is_user_connected(players) && g_previousspeak] != SPEAK_MUTED && players != id && !g_adminpa]){
      set_speak(players, SPEAK_NORMAL)
      client_print(players,print_center,"You have been unmuted and can voice chat normally")
   }
    }
    else{
   if (is_user_connected(id) && g_previousspeak] != SPEAK_MUTED && players != id && !g_adminpa]){
      set_speak(players, SPEAK_LISTENALL)
      client_print(players,print_center,"You are unmuted now, you can voice chat with other dead players")
   }
    }
   }
}
}
return PLUGIN_HANDLED
}
public death(){
if ( get_cvar_num("amx_deadchat")!=1 ) return PLUGIN_CONTINUE
new id = read_data(2)
if (g_adminpa) return PLUGIN_HANDLED
if (is_user_connected(id) && get_speak(id) != SPEAK_MUTED ) set_speak(id, SPEAK_LISTENALL)
client_print(id,print_center,"You are dead now, you can voice chat with other dead players")
return PLUGIN_HANDLED
}
public alive(id){
if (g_adminpa) return PLUGIN_HANDLED
if ( get_cvar_num("amx_deadchat")!=1 ) return PLUGIN_CONTINUE
if (is_user_connected(id) && get_speak(id) != SPEAK_MUTED ) set_speak(id, SPEAK_NORMAL)
return PLUGIN_CONTINUE
}

也就是说要将amx_mute playername及amx_unmute playername功能集成到上面的这段代码.Rulzy老大帮忙改下.amx_mute playername这个功能实在太好了.期待ing..........

gearfox 发表于 2007-9-13 22:14:05

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

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

我想要的是

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

T也一样...

能做吗???

Rulzy 发表于 2007-9-13 22:43:53

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

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

我想要的是

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

T也一样...

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

BliaNe 发表于 2007-9-14 01:12:35

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

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

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

ceoguang 发表于 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
SPEAK_LISTENALL+SPEAK_ALL
改为队伍正常通话应该就可以实现了吧.
同理,你发的代码中set_speak(victim,SPEAK_LISTENALL)
改为
set_speak(victim,SPEAK_NORMAL)

也就是无论死活都将通话设为队伍正常模式.
菜鸟一个,不知道说得对不对.:embarrass
另外,经测试,一楼的代码中
amx_mute playername命令执行成功后无任何效果,amx_mute #ID也无效,显示muted了,但玩家说的话依然可以听到,求解中...........
页: [1] 2 3 4
查看完整版本: 求类似UT、TEAMSPEAK工具的AMXX插件