|
本帖最后由 k1nader 于 2015-4-17 17:18 编辑
请问那个高人,加载后,显示没错,就是按了菜单后有静音显示,可是还是听到被静音的说话!
[mw_shl_code=pawn,true]#include <amxmodx>
#include <amxmisc>
#define MENU_SIZE 512
#define MENU_PLAYERS 8
new const PLUGIN[] = "Chat Mute"
new const VERSION[] = "1.6"
new const AUTHOR[] = "stupok69"
new const g_menutitle[][] =
{
" Mute%60s%i/%i^n^n",
"\y Mute%60s%i/%i^n\r::个人静音系统管理::^n^n\w"
}
new const g_menutext1[][] =
{
"%i.[管理员] %s ^n",
"\d%i. %s^n\w"
}
new const g_menutext2[][] =
{
"%i.[%s] %s ^n",
"%i. \r%s \w%s\w^n"
}
new g_is_counterstrike
//xeroblood
new g_nMenuPosition[33]
new g_nMenuPlayers[32]
//xeroblood
new bool:gb_mute[33][33]
new Float:gf_time[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say mute", "cmd_mutemenu")
register_clcmd("amx_mute", "cmd_mute", -1, "<name>")
register_clcmd("amx_mutemenu", "cmd_mutemenu", -1, "displays mute menu")
register_menucmd(register_menuid("Mute"), 1023, "handle_mutemenu")
register_message(get_user_msgid("SayText"), "message_SayText")
new modname[32]
get_modname(modname, 31)
if(equal(modname, "cstrike"))
{
g_is_counterstrike = 1
}
}
public message_SayText(iMsgid, iDest, receiver)
{
static sender
sender = get_msg_arg_int(1)
if(gb_mute[receiver][sender])
return PLUGIN_HANDLED
return PLUGIN_CONTINUE
}
public cmd_mute(id)
{
new arg1[32]
read_argv(1, arg1, 31)
if(!arg1[0])
{
client_print(id, print_console, "使用方法: amx_mute <name>")
return PLUGIN_HANDLED
}
new player = cmd_target(id, arg1, 0)
if(player)
{
exec_mute(id, player)
}
return PLUGIN_HANDLED
}
public exec_mute(id, target)
{
if(access(target, ADMIN_KICK))
{
client_print(id, print_console, "* [静音提示] 你不能对管理员使用静音系统.")
return 0
}
else if(target == id)
{
client_print(id, print_console, "* [静音提示] 你不能对自己使用静音系统.")
return 0
}
new Float:current_time = get_gametime()
new Float:interval = get_cvar_float("amx_flood_time")
if(current_time > gf_time[id] + interval)
{
gf_time[id] = current_time
}
else
{
client_print(id, print_chat, "* [静音提示] 请稍等 %f 秒才能再次使用静音系统.", interval)
return 0
}
gb_mute[id][target] = !gb_mute[id][target]
new name[32], name2[32]
get_user_name(target, name, 31)
get_user_name(id, name2, 31)
if (gb_mute[id][target])
client_print(0, print_chat, "* [静音提示] %s 被 %s 屏蔽了语音.", name , name2)
else
client_print(0, print_chat, "* [静音提示] %s 被 %s 恢复了语音.", name , name2)
return 1
}
/*
xeroblood's fantastic menu, customized
*/
public cmd_mutemenu(id)
{
show_mutemenu(id, g_nMenuPosition[id] = 0)
return PLUGIN_HANDLED
}
public handle_mutemenu(id, key)
{
switch(key)
{
case 8: show_mutemenu(id, ++g_nMenuPosition[id])
case 9: show_mutemenu(id, --g_nMenuPosition[id])
default:
{
new nPlayerID = g_nMenuPlayers[g_nMenuPosition[id] * MENU_PLAYERS + key]
exec_mute(id, nPlayerID)
show_mutemenu(id, g_nMenuPosition[id])
}
}
return PLUGIN_HANDLED
}
public show_mutemenu(id, pos)
{
if(pos < 0) return
new i, iPlayerID
new szMenuBody[MENU_SIZE]
new nCurrKey = 0
new szUserName[32]
new nStart = pos * MENU_PLAYERS
new nNum
get_players(g_nMenuPlayers, nNum)
if(nStart >= nNum)
nStart = pos = g_nMenuPosition[id] = 0
new nLen = format(szMenuBody, MENU_SIZE-1, g_menutitle[g_is_counterstrike], "", pos+1, (nNum / MENU_PLAYERS + ((nNum % MENU_PLAYERS) ? 1 : 0 )))
new nEnd = nStart + MENU_PLAYERS
new nKeys = (1<<9)
if( nEnd > nNum )
nEnd = nNum
for(i = nStart; i < nEnd; i++)
{
iPlayerID = g_nMenuPlayers
get_user_name(iPlayerID, szUserName, 31)
if(access(iPlayerID, ADMIN_KICK) || iPlayerID == id)
{
nCurrKey++
nLen += format(szMenuBody[nLen], (MENU_SIZE-1-nLen), g_menutext1[g_is_counterstrike], nCurrKey, szUserName)
}
else
{
nKeys |= (1<<nCurrKey++)
nLen += format(szMenuBody[nLen], (MENU_SIZE-1-nLen), g_menutext2[g_is_counterstrike], nCurrKey, (gb_mute[id][iPlayerID] ? "[静音]" : ""), szUserName)
}
}
if(nEnd != nNum)
{
format(szMenuBody[nLen], (MENU_SIZE-1-nLen), "^n9. 下页...^n0. %s", pos ? "上页..." : "退出")
nKeys |= (1<<8)
}
else
format(szMenuBody[nLen], (MENU_SIZE-1-nLen), "^n0. %s", pos ? "上页" : "退出")
show_menu(id, nKeys, szMenuBody, -1)
return
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg936\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset134 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2052\\ f0\\ fs16 \n\\ par }
*/[/mw_shl_code] |
|