搜索
查看: 1725|回复: 1

求助,需要个活死通话的插件

[复制链接]
发表于 2008-3-25 07:54:07 | 显示全部楼层 |阅读模式 来自 中国–陕西–西安
小弟 需要个 活人跟死人可以通话的插件,希望哪位大侠有 给 小弟传个
小弟 QQ  5462113 非常感谢!!!:cry:
发表于 2008-3-25 15:55:33 | 显示全部楼层 来自 中国–福建–龙岩

回复: 求助,需要个活死通话的插件

/***************************************************************************************
*amxmodx插件 amxmodx 1.71 测试通过
* 设置多种语音通讯模式的插件
* Friends_talk.sma
* 来源: http://cs-friends.com.cn

* 作者:iG_os,version 0.2.16 2006-6-24 22:00

*参数:friends_talk 1(默认) //0=sv_alltalk 0
* //1=sv_alltalk 1
* //2=活的队伍通信,死的听所有人声音
* //3=同队伍(死&活)都能通信,观察者听所有人声音(适合比赛用)
*amx命令:
*amx_friends_talk (0-3) 临时更改语音模式,功能同上
*adminspeak (打开/关闭)管理员发言模式,在任何模式下管理员都能和其他玩家通信
***************************************************************************************/
#define PLUGIN "Friends_Talk"
#define VERSION "0.2.16"
#define AUTHOR "iG_os"

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fun>

new g_talkMODE
new g_MAXPLAYERS
new g_adminspeak[33] = {false,...}

//=0模式,队伍语音 = sv_alltalk 0
public player_listen_default()
{
for (new id = 1; id <= g_MAXPLAYERS; id++)
if (is_user_connected(id))
if (!g_adminspeak[id]) //排除admin语音设置
set_speak(id, SPEAK_NORMAL) //id 恢复正常模式
set_cvar_num( "sv_alltalk",0 )
}

//=1模式,设置 id 与所有人相互通话 = sv_alltalk 1
public player_listen_all()
{
/*
for (new id = 1; id <= g_MAXPLAYERS; id++)
if (is_user_connected(id))
if (!g_adminspeak[id]) //排除admin语音设置
set_speak(id, SPEAK_NORMAL) //id 恢复正常模式
*/
set_cvar_num( "sv_alltalk",1 )
}

//=2模式,设置活得 id 与同队人语音,死得 id 听所有人声音
public player_listen_team(id)
{
if( !is_user_connected(id) ) return
if (g_adminspeak[id]) return //排除admin语音设置
new team = get_user_team(id)
if ( (team==1 || team==2) && is_user_alive(id) ) //id 是 T or CT 并且是活的
{
set_speak(id,SPEAK_NORMAL) //活得恢复默认
}
else
{
set_speak(id, SPEAK_LISTENALL) //死的听所有
}
}

//=3模式,设置id与T,CT同队(活的与死的)相互可以通话声音
public player_listen_teamall(id)
{
if ( !is_user_connected(id) ) return
if (g_adminspeak[id]) return //排除admin语音设置
new team = get_user_team(id)
if ( team!=1 && team!=2 ) //id 不是 T or CT
{
set_speak(id, SPEAK_LISTENALL) //观察者听所有
return
}
for( new other = 1;other<=g_MAXPLAYERS;other++)
{
if (is_user_connected(other))
if (!g_adminspeak[other]) //排除admin语音设置
if (other!=id)
if (team==get_user_team(other)) //other 与 id 同队
{
set_client_listen(id,other,1) //id 听到 other
set_client_listen(other,id,1) //other 听到 id
}
else
{
set_client_listen(id,other,0) //id 与 other 相互屏蔽声音
}
}
}

public player_spawn(id)
{
new param[1]
param[0] = id
set_task(0.3,"player_reset",123+id,param,1)
return PLUGIN_CONTINUE
}

public player_reset(param[])
{
new id = param[0]
if (g_adminspeak[id]) return
switch (g_talkMODE)
{
case 2: player_listen_team(id)
case 3: player_listen_teamall(id)
}
}

public death_event()
{
new param[1]
param[0] = read_data(2)
set_task(0.3,"player_reset",123+param[0],param,1)
return PLUGIN_CONTINUE
}

public joined_team()
{
new Arg1[64],name[32]
read_logargv(0,Arg1,63)
parse_loguser (Arg1, name, 31)
new id = get_user_index (name)
new param[1]
param[0] = id
set_task(7.0,"show_msg",565656+id,param,1)
set_task(0.3,"player_reset",123+id,param,1)
return PLUGIN_CONTINUE
}

public client_putinserver(id)
{
new param[1]
param[0] = id
set_task(0.3,"player_reset",123+id,param,1)
return PLUGIN_CONTINUE
}

public eRestart()
{
switch (g_talkMODE)
{
case 0: player_listen_default()
case 1: player_listen_all()
case 2:
{
set_cvar_num( "sv_alltalk",0 ) //sv_alltalk 0 必须要设为 0 才生效
for (new id = 1; id <= g_MAXPLAYERS; id++)
player_listen_team(id)
}
case 3:
{
set_cvar_num( "sv_alltalk",0 ) //sv_alltalk 0 必须要设为 0 才生效
for (new id = 1; id <= g_MAXPLAYERS; id++)
player_listen_teamall(id)
}
}
return PLUGIN_CONTINUE
}

public talkset(id,level,cid)
{
if (!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED
new arg[2]
read_argv(1,arg,2)
new res = str_to_num(arg)
if (res<0 || res>3)
return PLUGIN_HANDLED

g_talkMODE = res
new name[32]
get_user_name (id, name,31)
new msg[256]
format(msg,255,"^x01<^x03 %s^x01> ^x04改变语音模式",name)
color_text_all(id,msg)

new param[1]
param[0] = 0
show_msg(param)
eRestart()
log_amx("[%s] change friends_talk %d", name,g_talkMODE)
return PLUGIN_CONTINUE
}

public show_msg(param[])
{
new id = param[0]
new msg[256]
switch (g_talkMODE)
{
case 0: //队伍通话 sv_alltalk 0
format(msg,255,"^x01<^x04 cs-friends.com.cn 语音模式^x01 > ^x03队伍通话 sv_alltalk 0")
case 1: //所有人相互通话 sv_alltalk 1
format(msg,255,"^x01<^x04 cs-friends.com.cn 语音模式^x01 > ^x03所有人相互通话 sv_alltalk 1")
case 2: //同队活人之间相互通话,所有死亡人相互通话,并听见活着人说话模式
format(msg,255,"^x01<^x04 cs-friends.com.cn 语音模式^x01 > ^x03同队活人相互通话,所有死亡人相互通话,并听见活人说话")
case 3: //同队人之间死活都相互通话模式
format(msg,255,"^x01<^x04 cs-friends.com.cn 语音模式^x01 > ^x03同队人死活都相互通话模式,观察者听见所有人说话模式")
}
if (id==0) color_text_all(id,msg)
else color_text_one(id,msg)
}

public admin_speak(id,level,cid)
{
if (!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
new msg[256]
if (!g_adminspeak[id])
{
g_adminspeak[id] = true
set_speak(id, SPEAK_LISTENALL+SPEAK_ALL) //id 听,说所有
format(msg,255,"^x01<^x04管理员通话模式^x01> ^x03打开")
}
else
{
g_adminspeak[id] = false
new param[1]
param[0] = id
set_task(0.1,"player_reset",123+id,param,1)
format(msg,255,"^x01<^x04管理员通话模式^x01> ^x03关闭")
}
color_text_all(id,msg)
return PLUGIN_CONTINUE
}

public color_text_all(id,msg[])
{
message_begin(MSG_ALL, get_user_msgid("SayText"), {0,0,0}, id)
write_byte(id)
write_string(msg)
message_end()
}
public color_text_one(id,msg[])
{
message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, id)
write_byte(id)
write_string(msg)
message_end()
}

public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
register_event("ResetHUD", "player_spawn", "be")
register_event("DeathMsg", "death_event", "a")
register_event("TextMsg","eRestart","a","2&#Game_C","2&#Game_w")
register_logevent("joined_team", 3, "1=joined team") //"2=SPECTATOR" //"2=CT" //"2=TERRORIST"

register_concmd("adminspeak", "admin_speak", ADMIN_RESERVATION, "Admin speak is on/off")
register_concmd("amx_friends_talk","talkset",ADMIN_RESERVATION,"(0-3) Set friends_talk mode")
register_cvar("friends_talk","1")

g_talkMODE = get_cvar_num("friends_talk")
g_MAXPLAYERS = get_maxplayers()
return PLUGIN_CONTINUE
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg936\\ deff0\\ deflang1033\\ deflangfe2052{\\ fonttbl{\\ f0\\ fnil\\ fcharset134 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2052\\ f0\\ fs16 \n\\ par }
*/
回复

使用道具 举报

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

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