not tested, change the access urself
PHP Code:
#include < amxmodx >
#include < cstrike >
#include < ColorChat >
#define ADMIN_LISTEN ADMIN_RCON
enum _:enAdminsData
{
Flag,
Name[ 32 ]
};
new szAdmins[ ][ enAdminsData ] =
{
{ ADMIN_RCON, "Head Admin" },
{ ADMIN_IMMUNITY, "General Admin" },
{ ADMIN_BAN, "Super Admin" },
{ ADMIN_KICK, "Normal Admin" },
{ ADMIN_SLAY, "Helper Admin" }
};
new Cvars[ 3 ];
public plugin_init()
{
register_plugin( "Admins Tags", "1.0.0", "AMXX" );
register_clcmd( "say", "CmdSay" );
register_clcmd( "say_team", "CmdSayTeam" );
Cvars[ 0 ] = register_cvar( "at_enabled", "1" ); // Enable or Disable the plugin
Cvars[ 1 ] = register_cvar( "at_admin_listen", "1" ); // Admins can see say teams.( if "at_all_chat" is set to 0 then they will be able to see dead and alive as well )
Cvars[ 2 ] = register_cvar( "at_all_chat", "1" ); // Alive players can see Dead players messages.
}
public CmdSay( client )
{
if ( !( get_user_flags( client ) & ADMIN_SLAY ) )
return 0;
new szMsg[ 512 ];
read_args( szMsg, charsmax( szMsg ) );
remove_quotes( szMsg );
if ( szMsg[ 0 ] == '!' || szMsg[ 0 ] == '@' || szMsg[ 0 ] == '/' || equali( szMsg, "" ) || equali( szMsg, " " ) || equali( szMsg, " " ) )
return 0;
new iAdmin;
for ( new i; i < sizeof szAdmins; i++ )
{
if ( get_user_flags( client ) & szAdmins[ i ][ Flag ] )
{
iAdmin = i;
break;
}
}
PrintMessage( client, false, szAdmins[ iAdmin ][ Name ], GetUserName( client ), szMsg );
return 1;
}
public CmdSayTeam( client )
{
if ( !( get_user_flags( client ) & ADMIN_SLAY ) )
return 0;
new szMsg[ 512 ];
read_args( szMsg, charsmax( szMsg ) );
remove_quotes( szMsg );
if ( szMsg[ 0 ] == '!' || szMsg[ 0 ] == '@' || szMsg[ 0 ] == '/' || equali( szMsg, "" ) || equali( szMsg, " " ) || equali( szMsg, " " ) )
return 0;
new iAdmin;
for ( new i; i < sizeof szAdmins; i++ )
{
if ( get_user_flags( client ) & szAdmins[ i ][ Flag ] )
{
iAdmin = i;
break;
}
}
PrintMessage( client, true, szAdmins[ iAdmin ][ Name ], GetUserName( client ), szMsg );
return 1;
}
/* Stocks */
stock GetUserName( const index )
{
static g_szName[ 32 ];
get_user_name( index, g_szName, charsmax( g_szName ) );
return g_szName;
}
stock GetTeamColor( const index )
{
switch ( cs_get_user_team( index ) )
{
case CS_TEAM_CT: return BLUE;
case CS_TEAM_SPECTATOR: return GREY;
case CS_TEAM_T: return RED;
}
return 1;
}
stock GetTeamName( const index )
{
new szTeam[ 18 ];
switch ( cs_get_user_team( index ) )
{
case CS_TEAM_CT: szTeam = "Counter-Terrorist";
case CS_TEAM_SPECTATOR: szTeam = "SPEC";
case CS_TEAM_T: szTeam = "Terrorist";
}
return szTeam;
}
stock PrintMessage( const index, bool: bTeam, szTag[], szName[], szMsg[] )
{
static g_iMaxPlayers, szTeam[ 22 ];
g_iMaxPlayers = get_maxplayers();
if ( bTeam )
formatex( szTeam, charsmax( szTeam ), " (%s)", GetTeamName( index ) );
for ( new i = 1; i < g_iMaxPlayers; i++ )
{
if ( !is_user_connected( i ) )
continue;
if ( bTeam && get_pcvar_num( Cvars[ 1 ] ) == 1 && cs_get_user_team( index ) != cs_get_user_team( i ) && !( get_user_flags( i ) & ADMIN_LISTEN ) )
continue;
if ( get_pcvar_num( Cvars[ 2 ] ) == 0 )
{
if ( get_pcvar_num( Cvars[ 1 ] ) == 1 && !( get_user_flags( i ) & ADMIN_LISTEN ) )
{
if ( is_user_alive( index ) && !is_user_alive( i ) || !is_user_alive( index ) && is_user_alive( i ) )
continue;
}
}
ColorChat( i, GetTeamColor( index ), "^1%s%s^4[%s]^3 %s :^4 %s", is_user_alive( index ) ? "" : "*DEAD*", bTeam ? szTeam : "", szTag, szName, szMsg );
}
}