PHP Code:
/*
[colors]
"^1" // Yellow
"^3" // Team color
"^4" // Green
[Flags]
MOD flags "abcdefghijklmnopqrstu"
ADMIN flags "abcefghijkmnopqrstu"
VIP flags "bcefghijkmnopqrstu"
*/
#include <amxmodx>
#include <amxmisc>
#define HEADADMINFLAG ADMIN_IMMUNITY //Flag "d" rcon access
#define ADMINFLAG ADMIN_BAN //Flag "a" immunity
#define VIPFLAG ADMIN_RESERVATION //Flag "b" RESERVATION
new const tagcolor[ ] = "^4" // Tag color
new const chatcolor[ ] = "^1" // Chat color
new const vipchatco[ ] = "^4" // VIp chat color
new const headadPrefix[ ] = "[ADMIN]" //You can change it if you want [vip]
or what you want.
new const adminnPrefix[ ] = "[MOD]"
///////////////////////////////////////////////////////
new const VIPpppPrefix[ ] = "[VIP]"
public plugin_init()
{
register_plugin("Head & admin tag", "1.0", "Balck")
register_clcmd("say", "sayy")
register_clcmd("say_team", "sayyteam")
}
// Colorchat
//////////////////////////////////////////
enum Color
{
NORMAL = 1, // clients scr_concolor cvar color
GREEN, // Green Color
TEAM_COLOR, // Red, grey, blue
GREY, // grey
RED, // Red
BLUE, // Blue
}
new TeamName[][] =
{
"",
"TERRORIST",
"CT",
"SPECTATOR"
}
ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
{
if( !get_playersnum() ) return;
new message[256];
switch(type)
{
case NORMAL: // clients scr_concolor cvar color
{
message[0] = 0x01;
}
case GREEN: // Green
{
message[0] = 0x04;
}
case GREY: // Grey
{
message[0] = 0x05;
}
default: // White, Red, Blue
{
message[0] = 0x03;
}
}
vformat(message[1], 251, msg, 4);
// Make sure message is not longer than 192 character. Will crash
the server.
message[192] = '^0';
new team, ColorChange, index, MSG_Type;
if(id)
{
MSG_Type = MSG_ONE;
index = id;
} else {
index = FindPlayer();
MSG_Type = MSG_ALL;
}
team = get_user_team(index);
ColorChange = ColorSelection(index, MSG_Type, type);
ShowColorMessage(index, MSG_Type, message);
if(ColorChange)
{
Team_Info(index, MSG_Type, TeamName[team]);
}
}
ShowColorMessage(id, type, message[])
{
static bool:saytext_used;
static get_user_msgid_saytext;
if(!saytext_used)
{
get_user_msgid_saytext = get_user_msgid("SayText");
saytext_used = true;
}
message_begin(type, get_user_msgid_saytext, _, id);
write_byte(id)
write_string(message);
message_end();
}
Team_Info(id, type, team[])
{
static bool:teaminfo_used;
static get_user_msgid_teaminfo;
if(!teaminfo_used)
{
get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
teaminfo_used = true;
}
message_begin(type, get_user_msgid_teaminfo, _, id);
write_byte(id);
write_string(team);
message_end();
return 1;
}
ColorSelection(index, type, Color:Type)
{
switch(Type)
{
case RED:
{
return Team_Info(index, type, TeamName[1]);
}
case BLUE:
{
return Team_Info(index, type, TeamName[2]);
}
case GREY:
{
return Team_Info(index, type, TeamName[0]);
}
}
return 0;
}
FindPlayer()
{
new i = -1;
while(i <= get_maxplayers())
{
if(is_user_connected(++i))
return i;
}
return -1;
}
/////////////////////////////////////////////////////////////////
public sayy(id)
{
new name[33]
get_user_name(id,name,32)
new said[192]
read_args(said,191)
remove_quotes(said)
if(is_user_alive(id) && (get_user_flags(id) & HEADADMINFLAG))
{
ColorChat(0, GREEN,"%s%s ^3%s ^1: %s%s", tagcolor, headadPrefix,
name, chatcolor, said)
}
else
if(is_user_alive(id) && (get_user_flags(id) & ADMINFLAG))
{
ColorChat(0, GREEN,"%s%s ^3%s ^1: %s%s", tagcolor, adminnPrefix,
name, chatcolor, said)
}
else
if(is_user_alive(id) && (get_user_flags(id) & VIPFLAG))
{
ColorChat(0, GREEN,"%s%s ^3%s ^1: %s%s", tagcolor, VIPpppPrefix,
name, vipchatco, said)
}
else
if( get_user_team(id) == 3)
{
if(get_user_flags(id) & HEADADMINFLAG)
{
ColorChat(0, GREEN, "^1*SPEC* %s%s ^3%s ^1: %s%s", tagcolor,
headadPrefix, name, chatcolor, said)
}
else
if(get_user_flags(id) & ADMINFLAG)
{
ColorChat(0, GREEN, "^1*SPEC* %s%s ^3%s ^1: %s%s", tagcolor,
adminnPrefix, name, chatcolor, said)
}
else
if(get_user_flags(id) & VIPFLAG)
{
ColorChat(0, GREEN, "^1*SPEC* %s%s ^3%s ^1: %s%s", tagcolor,
VIPpppPrefix, name, vipchatco, said)
}
else
{
ColorChat(0, NORMAL, "^1*SPEC* ^3%s ^1: %s", name, said)
}
}
else
if(!is_user_alive(id) && (get_user_flags(id) & HEADADMINFLAG))
{
ColorChat(0, GREEN, "^1*DEAD* %s%s ^3%s ^1: %s%s", tagcolor,
headadPrefix, name, chatcolor, said)
}
else
if(!is_user_alive(id) && (get_user_flags(id) & ADMINFLAG))
{
ColorChat(0, GREEN, "^1*DEAD* %s%s ^3%s ^1: %s%s", tagcolor,
adminnPrefix, name, chatcolor, said)
}
else
if(!is_user_alive(id) && (get_user_flags(id) & VIPFLAG))
{
ColorChat(0, GREEN, "^1*DEAD* %s%s ^3%s ^1: %s%s", tagcolor,
VIPpppPrefix, name, vipchatco, said)
}
else
if( get_user_team(id) == 2)
{
if(is_user_alive(id))
{
ColorChat(0, NORMAL, "^3%s ^1: %s", name, said)
}
else
if(!is_user_alive(id))
{
ColorChat(0, NORMAL, "^1*DEAD* ^3%s ^1: %s", name, said)
}
}
else
if( get_user_team(id) == 1)
{
if(is_user_alive(id))
{
ColorChat(0, NORMAL, "^3%s ^1: %s", name, said)
}
else
if(!is_user_alive(id))
{
ColorChat(0, NORMAL, "^1*DEAD* ^3%s ^1: %s", name, said)
}
}
return PLUGIN_HANDLED
}
public sayyteam(id)
{
new name[33]
get_user_name(id,name,32)
new said[192]
read_args(said,191)
remove_quotes(said)
if(is_user_alive(id) && (get_user_flags(id) & HEADADMINFLAG))
{
ColorChat(0, GREEN,"^1(Counter-Terrorist) %s%s ^3%s ^1: %s%s",
tagcolor, headadPrefix, name, chatcolor, said)
}
else
if(is_user_alive(id) && (get_user_flags(id) & ADMINFLAG))
{
ColorChat(0, GREEN,"^1(Counter-Terrorist) %s%s ^3%s ^1: %s%s",
tagcolor, adminnPrefix, name, chatcolor, said)
}
else
if(is_user_alive(id) && (get_user_flags(id) & VIPFLAG))
{
ColorChat(0, GREEN,"^1(Counter-Terrorist) %s%s ^3%s ^1: %s%s",
tagcolor, VIPpppPrefix, name, vipchatco, said)
}
else
if( get_user_team(id) == 3)
{
if(get_user_flags(id) & HEADADMINFLAG)
{
ColorChat(0, GREEN, "^1(Spectator) %s%s ^3%s ^1: %s%s",
tagcolor, headadPrefix, name, chatcolor, said)
}
else
if(get_user_flags(id) & ADMINFLAG)
{
ColorChat(0, GREEN, "^1(Spectator) %s%s ^3%s ^1: %s%s",
tagcolor, adminnPrefix, name, chatcolor, said)
}
else
if(get_user_flags(id) & VIPFLAG)
{
ColorChat(0, GREEN, "^1(Spectator) %s%s ^3%s ^1: %s%s",
tagcolor, VIPpppPrefix, name, vipchatco, said)
}
else
{
ColorChat(0, NORMAL, "^1(Spectator) ^3%s ^1: %s", name, said)
}
}
else
if(!is_user_alive(id) && (get_user_flags(id) & HEADADMINFLAG))
{
{
ColorChat(0, GREEN, "^1*DEAD*(Counter-Terrorist) %s%s ^3%s ^1:
%s%s", tagcolor, headadPrefix, name, chatcolor, said)
}
}
else
if(!is_user_alive(id) && (get_user_flags(id) & ADMINFLAG))
{
ColorChat(0, GREEN, "^1*DEAD*(Counter-Terrorist) %s%s ^3%s ^1:
%s%s", tagcolor, adminnPrefix, name, chatcolor, said)
}
else
if(!is_user_alive(id) && (get_user_flags(id) & VIPFLAG))
{
ColorChat(0, GREEN, "^1*DEAD*(Counter-Terrorist) %s%s ^3%s ^1:
%s%s", tagcolor, VIPpppPrefix, name, vipchatco, said)
}
else
if( get_user_team(id) == 2)
{
if(is_user_alive(id))
{
ColorChat(0, NORMAL, "^1(Counter-Terrorist) ^3%s ^1: %s", name,
said)
}
else
if(!is_user_alive(id))
{
ColorChat(0, NORMAL, "^1*DEAD*(Counter-Terrorist) ^3%s ^1: %s",
name, said)
}
}
else
if( get_user_team(id) == 1)
{
if(is_user_alive(id))
{
ColorChat(0, NORMAL, "^1(Counter-Terrorist) ^3%s ^1: %s", name,
said)
}
else
if(!is_user_alive(id))
{
ColorChat(0, NORMAL, "^1*DEAD*(Counter-Terrorist) ^3%s ^1: %s",
name, said)
}
}
return PLUGIN_HANDLED
}