Code:
#include <amxmodx>
#define PLUGIN "Replace Admin Chat"
#define VERSION "1.0"
#define AUTHOR "CCC"
new szName[32], szTag[24];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_clcmd("say_team", "hook_say_team");
}
public hook_say_team(id)
{
new szText[192], szMessage[192];
read_args(szText, 191);
remove_quotes(szText);
get_user_name(id, szName,31);
new players[32], szPnum[32], tempid;
get_players(players, szPnum[id]);
for( new i; i<szPnum[id]; i++)
{
tempid = players[i]
new CsTeams:szPlayerTeam = cs_get_user_team(tempid)
new szTeam[32]
if (szPlayerTeam == CS_TEAM_T)
{
szTeam = "[TE]"
}
else if (szPlayerTeam == CS_TEAM_CT)
{
szTeam = "[CT]"
}
else
{
szTeam = "[SPEC]"
}
if(is_user_alive(id))
{
format(szMessage, 191, "^x03%s %s ^x01: %s", szTeam, szName, szText)
client_color(tempid, id, szMessage);
client_print(tempid, print_console, "%s %s : %s", szTeam, szName, szText)
}
else
{
format(szMessage, 191, "^x01*DEAD* ^x03%s %s ^x01: %s", szTeam, szName, szText)
client_color(tempid, id, szMessage);
client_print(tempid, print_console, "*DEAD* %s %s : %s", szTeam, szName, szText)
}
if(contain(szText, "@") == 0)
{
if(get_user_flags(id) & ADMIN_ADMIN)
szTag = "(ADMIN)"
else
szTag = "(PLAYER)"
format(szMessage, 191, "^x04%s %s ^x01: %s", szTag, szName, szText)
client_color(id, id, szMessage);
}
}
return PLUGIN_HANDLED;
}
public client_color(playerid, colorid, message[])
{
message_begin(playerid?MSG_ONE:MSG_ALL, get_user_msgid("SayText"), {0, 0, 0}, playerid)
write_byte(colorid)
write_string(message)
message_end()
}