静音菜单插件
本帖最后由 千喜哥 于 2009-4-7 13:32 编辑为了给大家节约资金 我就不发插件了 直接把代码发上来
此插件没汉化!!!
插件描述:
提供了一个菜单客户静音其他客户。
客户端的命令:
say /mute 说/静音
say_team /mute say_team /静音#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#define PLUGIN "mute menu"
#define VERSION "1.0"
#define AUTHOR "cheap_suit"
#define MAX_PLAYERS 32
new bool:g_mute
new g_menuposition
new g_menuplayers
new g_menuplayersnum
new cvar_alltalk
new g_maxclients
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar(PLUGIN, VERSION, FCVAR_SPONLY|FCVAR_SERVER)
register_clcmd("say", "clcmd_say")
register_clcmd("say_team", "clcmd_say")
register_forward(FM_Voice_SetClientListening, "fwd_voice_setclientlistening")
register_menucmd(register_menuid("mute menu"), 1023, "action_mutemenu")
cvar_alltalk = get_cvar_pointer("sv_alltalk")
g_maxclients = global_get(glb_maxClients)
}
public client_putinserver(id)
clear_list(id)
public client_disconnect(id)
clear_list(id)
clear_list(id)
{
for(new i = 0; i <= g_maxclients; ++i)
g_mute = false
}
public clcmd_say(id)
{
static say_args
read_args(say_args, 9)
remove_quotes(say_args)
if(say_args == '/' && containi(say_args, "mute") != -1)
{
display_mutemenu(id, g_menuposition = 0)
return PLUGIN_HANDLED_MAIN
}
return PLUGIN_CONTINUE
}
public fwd_voice_setclientlistening(receiver, sender, listen)
{
if(receiver == sender)
return FMRES_IGNORED
if(g_mute)
{
engfunc(EngFunc_SetClientListening, receiver, sender, 0)
return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}
display_mutemenu(id, pos)
{
if(pos < 0)
return
static team
get_user_team(id, team, 10)
new at = get_pcvar_num(cvar_alltalk)
get_players(g_menuplayers, g_menuplayersnum,
at ? "c" : "ce", at ? "" : team)
new start = pos * 8
if(start >= g_menuplayersnum)
start = pos = g_menuposition
new end = start + 8
if(end > g_menuplayersnum)
end = g_menuplayersnum
static menubody
new len = format(menubody, 511, "\wMute Menu^n^n")
static name
new b = 0, i
new keys = MENU_KEY_0
for(new a = start; a < end; ++a)
{
i = g_menuplayers
get_user_name(i, name, 31)
if(i == id)
{
++b
len += format(menubody, 511 - len, "\d#%s %s\w^n", name, g_mute ? "(Muted)" : "")
}
else
{
keys |= (1<<b)
len += format(menubody, 511 - len, "%s%d. %s %s\w^n", g_mute ? "\y" : "\w", ++b, name, g_mute ? "(Muted)" : "")
}
}
if(end != g_menuplayersnum)
{
format(menubody, 511 - len, "^n9. %s...^n0. %s", "More", pos ? "Back" : "Exit")
keys |= MENU_KEY_9
}
else
format(menubody, 511-len, "^n0. %s", pos ? "Back" : "Exit")
show_menu(id, keys, menubody, -1, "mute menu")
}
public action_mutemenu(id, key)
{
switch(key)
{
case 8: display_mutemenu(id, ++g_menuposition)
case 9: display_mutemenu(id, --g_menuposition)
default:
{
new player = g_menuplayers * 8 + key]
g_mute = g_mute ? false : true
display_mutemenu(id, g_menuposition)
static name
get_user_name(player, name, 31)
client_print(id, print_chat, "You have %smuted %s", g_mute ? "" : "un", name)
}
}
return PLUGIN_HANDLED
}
作用是啥?脚步还是说话静音,不愿意听别人说话? 楼主不是说的很详细了么,结合下原创区的帖子.你就明白了`
页:
[1]