|
希望能有一个这样的插件.
队友之间,无论死活,都可以按通话键,比如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)
}
}
还请大家帮忙。。。。。。 |
|