Rejack

Admins Tags (v1.0)

Jul 24th, 2013 (edited)
960
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.75 KB | None | 0 0
  1. /* Plugin was created by Rejack and was never tested. */
  2.  
  3. #include < amxmodx >
  4. #include < cstrike >
  5. #include < ColorChat >
  6.  
  7. #define ADMIN_LISTEN        ADMIN_RCON
  8.  
  9. enum _:enAdminsData
  10. {
  11.     Flag,
  12.     Name[ 32 ]
  13. };
  14.  
  15. new szAdmins[ ][ enAdminsData ] =
  16. {
  17.     { ADMIN_RCON,       "OWNER" },
  18.     { ADMIN_IMMUNITY,   "MANAGER" },
  19.     { ADMIN_BAN,        "SUPER ADMIN" },
  20.     { ADMIN_KICK,       "ADMIN" },
  21.     { ADMIN_SLAY,       "VIP" }
  22. };
  23.  
  24. new Cvars[ 3 ];
  25.  
  26. public plugin_init()
  27. {
  28.     register_plugin( "Admins Tags", "1.0", "Rejack" );
  29.    
  30.     register_clcmd( "say", "CmdSay" );
  31.    
  32.     register_clcmd( "say_team", "CmdSayTeam" );
  33.    
  34.     Cvars[ 0 ] = register_cvar( "at_enabled", "1" );            // Enable or Disable the plugin
  35.     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 )
  36.     Cvars[ 2 ] = register_cvar( "at_all_chat", "1" );       // Alive players can see Dead players messages.
  37. }
  38.  
  39. public CmdSay( client )
  40. {
  41.     if ( !( get_user_flags( client ) & ADMIN_SLAY ) )
  42.         return 0;
  43.    
  44.     new szMsg[ 512 ];
  45.    
  46.     read_args( szMsg, charsmax( szMsg ) );
  47.    
  48.     remove_quotes( szMsg );
  49.    
  50.     if ( szMsg[ 0 ] == '!' || szMsg[ 0 ] == '@' || szMsg[ 0 ] == '/' || equali( szMsg, "" ) || equali( szMsg, " " ) || equali( szMsg, "   " ) )
  51.         return 0;
  52.    
  53.     new iAdmin;
  54.    
  55.     for ( new i; i < sizeof szAdmins; i++ )
  56.     {
  57.         if ( get_user_flags( client ) & szAdmins[ i ][ Flag ] )
  58.         {
  59.             iAdmin = i;
  60.            
  61.             break;
  62.         }
  63.     }
  64.    
  65.     PrintMessage( client, false, szAdmins[ iAdmin ][ Name ], GetUserName( client ), szMsg );
  66.    
  67.     return 1;
  68. }
  69.  
  70. public CmdSayTeam( client )
  71. {
  72.     if ( !( get_user_flags( client ) & ADMIN_SLAY ) )
  73.         return 0;
  74.    
  75.     new szMsg[ 512 ];
  76.    
  77.     read_args( szMsg, charsmax( szMsg ) );
  78.    
  79.     remove_quotes( szMsg );
  80.    
  81.     if ( szMsg[ 0 ] == '!' || szMsg[ 0 ] == '@' || szMsg[ 0 ] == '/' || equali( szMsg, "" ) || equali( szMsg, " " ) || equali( szMsg, "   " ) )
  82.         return 0;
  83.    
  84.     new iAdmin;
  85.    
  86.     for ( new i; i < sizeof szAdmins; i++ )
  87.     {
  88.         if ( get_user_flags( client ) & szAdmins[ i ][ Flag ] )
  89.         {
  90.             iAdmin = i;
  91.            
  92.             break;
  93.         }
  94.     }
  95.    
  96.     PrintMessage( client, true, szAdmins[ iAdmin ][ Name ], GetUserName( client ), szMsg );
  97.    
  98.     return 1;
  99. }
  100.  
  101. /* Stocks */
  102.  
  103. stock GetUserName( const index )
  104. {
  105.     static g_szName[ 32 ];
  106.    
  107.     get_user_name( index, g_szName, charsmax( g_szName ) );
  108.    
  109.     return g_szName;
  110. }
  111.  
  112. stock GetTeamColor( const index )
  113. {
  114.     switch ( cs_get_user_team( index ) )
  115.     {
  116.         case CS_TEAM_CT:    return BLUE;
  117.        
  118.         case CS_TEAM_SPECTATOR: return GREY;
  119.        
  120.         case CS_TEAM_T:     return RED;
  121.     }
  122.    
  123.     return 1;
  124. }
  125.  
  126. stock GetTeamName( const index )
  127. {
  128.     new szTeam[ 18 ];
  129.    
  130.     switch ( cs_get_user_team( index ) )
  131.     {
  132.         case CS_TEAM_CT:    szTeam = "Counter-Terrorist";
  133.        
  134.         case CS_TEAM_SPECTATOR: szTeam = "SPEC";
  135.        
  136.         case CS_TEAM_T:     szTeam = "Terrorist";
  137.     }
  138.    
  139.     return szTeam;
  140. }
  141.  
  142. stock PrintMessage( const index, bool: bTeam, szTag[], szName[], szMsg[] )
  143. {
  144.     static g_iMaxPlayers, szTeam[ 22 ];
  145.    
  146.     g_iMaxPlayers = get_maxplayers();
  147.    
  148.     if ( bTeam )
  149.         formatex( szTeam, charsmax( szTeam ), " (%s)", GetTeamName( index ) );
  150.    
  151.     for ( new i = 1; i < g_iMaxPlayers; i++ )
  152.     {
  153.         if ( !is_user_connected( i ) )
  154.             continue;
  155.        
  156.         if ( bTeam && get_pcvar_num( Cvars[ 1 ] ) == 1 && cs_get_user_team( index ) != cs_get_user_team( i ) && !( get_user_flags( i ) & ADMIN_LISTEN ) )
  157.             continue;
  158.        
  159.         if ( get_pcvar_num( Cvars[ 2 ] ) == 0 )
  160.         {
  161.             if ( get_pcvar_num( Cvars[ 1 ] ) == 1 && !( get_user_flags( i ) & ADMIN_LISTEN ) )
  162.             {
  163.                 if ( is_user_alive( index ) && !is_user_alive( i ) || !is_user_alive( index ) && is_user_alive( i ) )
  164.                     continue;
  165.             }
  166.         }
  167.        
  168.         ColorChat( i, GetTeamColor( index ), "^1%s%s^4[%s]^3 %s :^4 %s", is_user_alive( index ) ? "" : "*DEAD*", bTeam ? szTeam : "", szTag, szName, szMsg );
  169.     }
  170. }
Advertisement
Add Comment
Please, Sign In to add comment