求一个管理员说话变色的插件
以前有一个OP说话颜色是绿色的插件,哪位DX有的话能不能传上来,小弟急用..谢谢! 没人有么.. 本帖最后由 TCMBW 于 2009-8-14 13:58 编辑// COLOR CHAT LEVELS
// --------------------------------------------------------------------------------------
#define ADMIN_NORMAL ADMIN_LEVEL_A // level for normal chat with green name only
#define ADMIN_RED ADMIN_LEVEL_B // level for red chat
#define ADMIN_BLUE ADMIN_LEVEL_C // level for blue chat
#define ADMIN_SILVER ADMIN_LEVEL_D // level for silver chat
// --------------------------------------------------------------------------------------
// ADMIN LISTEN LEVELS
// --------------------------------------------------------------------------------------
#define LISTEN_CHAT ADMIN_KICK // level to see all chat (adminlisten style)
#define LISTEN_VOICE ADMIN_IMMUNITY // level to hear all voices (adminlisten style)
// --------------------------------------------------------------------------------------
// DO NOT EDIT BEYOND THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
// --------------------------------------------------------------------------------------
#include <amxmodx>
#include <fakemeta>
#define SPEAK_NORMAL (1<<0)
//#define SPEAK_MUTED (1<<1)
#define SPEAK_ALL (1<<2)
#define SPEAK_LISTENALL (1<<3)
new pCvar_enabled;
new pCvar_voice;
new pCvar_chat;
new pCvar_alltalk;
new giMaxPlayers;
new giMsgSayText;
new giMsgTeamInfo;
new giSpeakFlags;
new const giColorLevels[] =
{
ADMIN_ALL,
ADMIN_NORMAL,
ADMIN_RED,
ADMIN_BLUE,
ADMIN_SILVER
};
new const gszColorCode[][] =
{
"",
"^x01",
"^x03",
"^x03",
"^x03"
};
new const gszColorTeams[][] =
{
"",
"",
"TERRORIST",
"CT",
"SPECTATOR"
};
new const gszTeamNames[][] =
{
"Spectator",
"Terrorist",
"Counter-Terrorist",
"Spectator"
};
public plugin_init()
{
register_plugin("Colored Admin Chat", "4.0", "Exolent");
register_clcmd("say", "handle_say");
register_clcmd("say_team", "handle_teamsay");
register_forward(FM_Voice_SetClientListening, "fm_SetVoice");
pCvar_enabled = register_cvar("amx_cac_enabled", "1");
pCvar_voice = register_cvar("amx_adminlisten_voice", "1");
pCvar_chat = register_cvar("amx_adminlisten_chat", "1");
pCvar_alltalk = get_cvar_pointer("sv_alltalk");
giMaxPlayers = get_maxplayers();
giMsgSayText = get_user_msgid("SayText");
giMsgTeamInfo = get_user_msgid("TeamInfo");
}
public handle_say(id)
{
if(!get_pcvar_num(pCvar_enabled))
return PLUGIN_CONTINUE;
static szMessage;
read_args(szMessage, 191);
remove_quotes(szMessage);
if(!is_valid_message(szMessage))
return PLUGIN_CONTINUE;
static bool:bAdmin;
bAdmin = has_color_chat(id);
static iChatColor, iAlive, i;
iChatColor = get_chat_color(id);
iAlive = is_user_alive(id);
new Dami;
Dami = iChatColor - 2;
static szName, szTeam, szTeam2;
get_user_name(id, szName, 31);
get_user_team(id, szTeam, 31);
format(szMessage, 191, "%s%s%s%s ^x01: %s %s",\
iAlive ? "" : "^x01*闃典骸*",\
bAdmin ? (Dami ? "^x03(缁挎槦缃戝惂)" : "^x03(绠$悊鍛?"): "^x01",\
bAdmin ? "^x04" : "^x01",\
szName,\
bAdmin ? gszColorCode : "",\
szMessage);
for(i = 1; i <= giMaxPlayers; i++)
{
if(!is_user_connected(i))
continue;
if(iAlive == is_user_alive(i)
|| (get_pcvar_num(pCvar_chat)) && (get_user_flags(i) & LISTEN_CHAT))
{
get_user_team(i, szTeam2, 31);
handle_message(i, szTeam, szTeam2, iChatColor, szMessage);
}
}
return PLUGIN_HANDLED;
}
public handle_teamsay(id)
{
if(!get_pcvar_num(pCvar_enabled))
return PLUGIN_CONTINUE;
static szMessage;
read_args(szMessage, 191);
remove_quotes(szMessage);
if(!is_valid_message(szMessage))
return PLUGIN_CONTINUE;
static bool:bAdmin;
bAdmin = has_color_chat(id);
static iChatColor, iAlive, iTeam, i;
iChatColor = get_chat_color(id);
iAlive = is_user_alive(id);
iTeam = get_user_team(id);
new Dami2;
Dami2 = iChatColor - 2;
static szName, szTeam, szTeam2;
get_user_name(id, szName, 31);
get_user_team(id, szTeam, 31);
format(szMessage, 191, "^x01%s(%s)%s%s %s^x01 : %s %s",\
iAlive ? "" : "*DEAD*",\
gszTeamNames,\
bAdmin ? (Dami2 ? "^x03(缁挎槦缃戝惂)" : "^x03(绠$悊鍛?"): "^x01",\
bAdmin ? "^x04" : "^x03",\
szName,\
bAdmin ? gszColorCode : "",\
szMessage);
for(i = 1; i <= giMaxPlayers; i++)
{
if(!is_user_connected(i))
continue;
get_user_team(i, szTeam2, 31);
if(!equali(szTeam, szTeam2) && (get_pcvar_num(pCvar_chat) != 1))
continue;
if(iAlive == is_user_alive(i)
|| get_user_flags(i) & LISTEN_CHAT)
{
handle_message(id, szTeam, szTeam2, iChatColor, szMessage);
}
}
return PLUGIN_HANDLED;
}
public fm_SetVoice(iReceiver, iSender, bool:bListen)
{
reset_speak(iReceiver);
reset_speak(iSender);
if((giSpeakFlags & SPEAK_ALL) != 0)
{
set_speak(iReceiver, iSender, true);
return FMRES_SUPERCEDE;
}
if((giSpeakFlags & SPEAK_LISTENALL) != 0)
{
set_speak(iReceiver, iSender, true);
return FMRES_SUPERCEDE;
}
forward_return(FMV_CELL, bListen);
return FMRES_IGNORED;
}
bool:is_valid_message(const szMessage[])
{
if(szMessage == '/'
|| szMessage == '@'
|| !strlen(szMessage))
{
return false;
}
return true;
}
bool:has_color_chat(const id)
{
static iFlags, i;
iFlags = get_user_flags(id);
for(i = 1; i < sizeof giColorLevels; i++)
{
if(iFlags & giColorLevels)
return true;
}
return false;
}
get_chat_color(const id)
{
static iFlags, i;
iFlags = get_user_flags(id);
for(i = 1; i < sizeof giColorLevels; i++)
{
if(iFlags & giColorLevels)
return i;
}
return 0;
}
handle_message(const id, const szTeam[], const szTeam2[], const iChatColor, const szMessage[])
{
if(equali(gszColorCode, "^x03") && !equali(gszColorTeams, szTeam2))
{
show_TeamInfo_msg(id, gszColorTeams);
show_SayText_msg(id, szMessage);
show_TeamInfo_msg(id, szTeam2);
}
else if(!equali(szTeam, szTeam2) && !iChatColor)
{
show_TeamInfo_msg(id, szTeam);
show_SayText_msg(id, szMessage);
show_TeamInfo_msg(id, szTeam2);
}
else
{
show_SayText_msg(id, szMessage);
}
return 1;
}
show_TeamInfo_msg(const id, const szTeam[])
{
message_begin(MSG_ONE, giMsgTeamInfo, _, id);
write_byte(id);
write_string(szTeam);
message_end();
}
show_SayText_msg(const id, const szMessage[])
{
message_begin(MSG_ONE, giMsgSayText, _, id);
write_byte(id);
write_string(szMessage);
message_end();
}
reset_speak(const id)
{
if(get_pcvar_num(pCvar_alltalk) == 1)
{
giSpeakFlags = SPEAK_ALL;
}
else if((get_pcvar_num(pCvar_voice) == 1) && (get_user_flags(id) & LISTEN_VOICE))
{
giSpeakFlags = SPEAK_LISTENALL;
}
else
{
giSpeakFlags = SPEAK_NORMAL;
}
}
set_speak(const iReceiver, const iSender, const bool:bListen)
{
engfunc(EngFunc_SetClientListening, iReceiver, iSender, bListen)
forward_return(FMV_CELL, bListen);
} 我有~!~!~! http://cschina.home.sunbo.net/show_hdr.php?xname=4PU1331&dname=0VCVD31&xpos=149
到这里去下吧,以前用过还不错
页:
[1]