应大家的需求,特发布此插件:
插件名称:团队语音控制插件
插件作者:Rulzy
Web URL :
http://bbs.co....cn/ 命令说明:
amx_mute <name or #userid>静音某玩家麦克风
amx_unmute <name or #userid>取消静音某玩家麦克风
参数说明:
amx_teamtalk 0|1 (默认:1)是否开启此插件的语音控制功能
amx_talkhint 0|1|2 (默认:1)提示类型:0-关闭, 1-HUD, 2-聊天区
amx_talktime数据值(默认:0)语音控制的一个时间参数,详细说明见后。
参数amx_talktime说明:
当amx_talktime为0时,队友间总是可以互相听到讲话(当然,要求参数amx_teamtalk不为零,下同)
当amx_talktime为正数时,玩家死亡后的amx_talktime秒内,活着的队友可以听到其讲话,超过这个时间则活着的队友听不到其讲话了
主要用于:当玩家刚死亡时,可以给活着的队友报点,又可以避免一直讲话而影响活着的队友发挥
当amx_talktime为负数时,玩家死亡后的|amx_talktime|秒内,活着的队友听不到其讲话,超过这个时间则活着的队友可以听到其讲话
主要用于:当玩家刚死亡时,避免玩家报点,但时间过后可以通话,可用于战术指挥,训练时感觉比较有用
注意,参数sv_alltalk必须为0,否则此插件功能不会生效。
/*
插件名称:团队语音控制插件
插件作者:Rulzy
Web URL :
http://bbs.co....cn/命令说明:
amx_mute <name or #userid> 静音某玩家麦克风
amx_unmute <name or #userid> 取消静音某玩家麦克风
参数说明:
amx_teamtalk 0|1 (默认:1)是否开启此插件的语音控制功能
amx_talkhint 0|1|2 (默认:1)提示类型:0-关闭, 1-HUD, 2-聊天区
amx_talktime 整数值 (默认:0)语音控制的一个时间参数,详细说明见后。
参数 amx_talktime 说明:
当 amx_talktime 为 0 时,队友间总是可以互相听到讲话(当然,要求参数amx_teamtalk不为零,下同)
当 amx_talktime 为正数时,玩家死亡后的amx_talktime秒内,
活着的队友可以听到其讲话,超过这个时间则活着的队友听不到其讲话了
主要用于:当玩家刚死亡时,可以给活着的队友报点,又可以避免一直讲话而影响活着的队友发挥
当 amx_talktime 为负数时,玩家死亡后的 |amx_talktime| 秒内,
活着的队友听不到其讲话,超过这个时间则活着的队友可以听到其讲话
主要用于:当玩家刚死亡时,避免玩家报点,但时间过后可以通话,可用于战术指挥,训练时感觉比较有用
注意,参数 sv_alltalk 必须为0,否则此插件功能不会生效。
--------------------------------------------------------------------------------------------------------------
*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
new g_player_muted[33]
new Float: g_player_deathtime[33]
new p_teamtalk, p_talktime, p_talkhint
public plugin_init()
{
register_plugin("Team Talk", "1.2", "Rulzy");
register_forward(FM_Voice_SetClientListening, "fm_voice_forward")
register_clcmd("amx_mute", "cmdMute", ADMIN_KICK, "<name or #userid> - Mute player's Microphone");
register_clcmd("amx_unmute", "cmdUnMute", ADMIN_KICK, "<name or #userid> - UnMute player's Microphone");
p_teamtalk = register_cvar("amx_teamtalk", "1");
p_talktime = register_cvar("amx_talktime", "0");
p_talkhint = register_cvar("amx_talkhint", "1");
register_event("DeathMsg", "eDeathMsg", "a");
}
public eDeathMsg()
{
new victim = read_data(2);
if(!is_user_connected(victim)) return PLUGIN_CONTINUE;
g_player_deathtime[victim] = get_gametime();
if(get_cvar_num("sv_alltalk")) return PLUGIN_CONTINUE;
if(!get_pcvar_num(p_teamtalk)) return PLUGIN_CONTINUE;
if(g_player_muted[victim] && get_user_flags(victim)&ADMIN_IMMUNITY==0) //如果此人被禁止讲话
return PLUGIN_CONTINUE;
if(!get_pcvar_num(p_talkhint))
return PLUGIN_CONTINUE;
new talktime = get_pcvar_num(p_talktime);
talktime = talktime>0?talktime:-talktime;
new param[3]
param[0] = victim;
param[1] = talktime;
ShowHint(param);
return PLUGIN_CONTINUE;
}
public ShowHint(param[])
{
if(get_cvar_num("sv_alltalk")) return PLUGIN_CONTINUE;
if(!get_pcvar_num(p_teamtalk)) return PLUGIN_CONTINUE;
new id = param[0];
new talktime = get_pcvar_num(p_talktime);
new timeleft = param[1];
new HintMsg[256];
new talkhint = get_pcvar_num(p_talkhint);
if(talkhint==1)
{
if(is_user_alive(id))
{
format(HintMsg, 255, "你已经出生, 现在你可以与你的队友正常语音通话");
timeleft = 0;
}else if(talktime==0){
format(HintMsg, 255, "你挂了, 但你仍然可以与你的队友语音通话");
}else if(talktime>0){
if(timeleft==0)
format(HintMsg, 255, "时间到, 你现在不能跟活着的队友通话了", timeleft);
else
format(HintMsg, 255, "你挂了, 但 %d 秒内你仍然可以与活着的队友通话", timeleft);
}else{
if(timeleft==0)
format(HintMsg, 255, "你现在可以跟活着的队友通话了", timeleft);
else
format(HintMsg, 255, "你挂了, %d 秒后你可与活着的队友通话", timeleft);
}
set_hudmessage(255, 196, 196, -1.0, 0.73, 0, 0.0, 3.0, 0.0, 0.0, 1)
show_hudmessage(id, HintMsg)
}else if (talkhint==2){
if(is_user_alive(id))
{
format(HintMsg, 255, "^x04【语音控制】^x01你已经出生, 现在你可以与你的队友正常语音通话。");
timeleft = 0;
}else if(talktime==0){
format(HintMsg, 255, "^x04【语音控制】^x01你挂了, 但你仍然可以与你的队友语音通话。");
}else if(talktime>0){
if(timeleft==0)
format(HintMsg, 255, "^x04【语音控制】^x01时间到, 你现在不能跟活着的队友通话了。", timeleft);
else
format(HintMsg, 255, "^x04【语音控制】^x01你挂了, 但 %d 秒内你仍然可以与活着的队友通话。", timeleft);
}else{
if(timeleft==0)
format(HintMsg, 255, "^x04【语音控制】^x01你现在可以跟活着的队友通话了。", timeleft);
else
format(HintMsg, 255, "^x04【语音控制】^x01你挂了, %d 秒后你可与活着的队友通话。", timeleft);
}
client_color(id, id, HintMsg);
}
if(timeleft>0)
{
param[1]=timeleft-1;
set_task(1.0, "ShowHint", 0, param, 2);
}
return PLUGIN_CONTINUE;
}
public fm_voice_forward(receiver, sender, listen)
{
if(receiver==sender) return FMRES_IGNORED;
new alltalk = get_cvar_num("sv_alltalk");
if(alltalk) return FMRES_IGNORED;
if(!get_pcvar_num(p_teamtalk)) return FMRES_IGNORED;
if(!is_user_connected(receiver) || !is_user_connected(sender))
return FMRES_IGNORED;
if(g_player_muted[sender] && get_user_flags(sender)&ADMIN_IMMUNITY==0) //如果此人被禁止讲话
{
engfunc(EngFunc_SetClientListening, receiver, sender, 0);
return FMRES_SUPERCEDE;
}
new CsTeams:rt=cs_get_user_team(receiver);
new CsTeams:st=cs_get_user_team(sender);
if(rt==CS_TEAM_UNASSIGNED || rt==CS_TEAM_SPECTATOR) //观察员可以听到所有人讲话
{
engfunc(EngFunc_SetClientListening, receiver, sender, 1);
return FMRES_SUPERCEDE;
}
if(rt==st){ //如果是队友间讲话
if(is_user_alive(sender)) //活着的队友讲话,队友都可以听到
{
engfunc(EngFunc_SetClientListening, receiver, sender, 1);
return FMRES_SUPERCEDE;
}
//死亡的队友讲话,分两种情况
if(!is_user_alive(receiver)) //一:死亡的队友可以听到死亡的队友讲话(包括两者都是观察员的情况)
{
engfunc(EngFunc_SetClientListening, receiver, sender, 1);
return FMRES_SUPERCEDE;
}
//二:如果讲话者是死的,听话者是活的,则根据参数和死亡时间来区分
new talktime = get_pcvar_num(p_talktime);
if(talktime == 0)
{
engfunc(EngFunc_SetClientListening, receiver, sender, 1); //总可以听到队友讲话
return FMRES_SUPERCEDE;
}
new Float:gametime = get_gametime();
if(talktime>0){ //队友死亡后多少秒内活着的队友可以听到,可用于报点,但可防止时间过后影响活着的队友发挥
if(gametime-g_player_deathtime[sender]>talktime)//如果当前时间-最后死亡时间>指定的时间,则活的队友听不到讲话
{
engfunc(EngFunc_SetClientListening, receiver, sender, 0);
}else{ //否则(当前时间-最后死亡时间<=指定的时间),活的队友可听到讲话
engfunc(EngFunc_SetClientListening, receiver, sender, 1);
}
}else{ //队友死亡后多少秒内活着的队友听不到,可防止报点,但这个时间过后可以进行战术指挥
talktime = - talktime; //取绝对值
if(gametime-g_player_deathtime[sender]>talktime)//如果当前时间-最后死亡时间>指定的时间,则活的队友可听到讲话
{
engfunc(EngFunc_SetClientListening, receiver, sender, 1);
}else{ //否则(当前时间-最后死亡时间<=指定的时间),活的队友听不到讲话
engfunc(EngFunc_SetClientListening, receiver, sender, 0);
}
}
}else{ //否则听不到讲话(不是队友,也不是观察员)
engfunc(EngFunc_SetClientListening, receiver, sender, 0);
}
return FMRES_SUPERCEDE;
}
public client_connect(id)
{
g_player_muted[id] = 0;
g_player_deathtime[id] = get_gametime();
}
public cmdMute(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED;
new name[32];
read_argv(1, name, 31);
new target = cmd_target(id, name, 1);
if(!target) return PLUGIN_HANDLED;
g_player_muted[target] = 1
return PLUGIN_HANDLED;
}
public cmdUnMute(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED;
new name[32];
read_argv(1, name, 31);
new target = cmd_target(id, name, 0);
if(!target) return PLUGIN_HANDLED;
g_player_muted[target] = 0
return PLUGIN_HANDLED;
}
stock client_color(playerid,colorid,msg[])
{
message_begin(playerid?MSG_ONE:MSG_ALL, get_user_msgid("SayText"), {0,0,0}, playerid)
write_byte(colorid)
write_string(msg)
message_end()
}
/* UTF-8 func by
DT-Club.net... */