Rejack

AMXX Admin Chat v0.5b by Rejack

Mar 19th, 2013 (edited)
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.08 KB | None | 0 0
  1. #include < amxmodx >
  2.  
  3. new Lines, pCvar;
  4.  
  5. new Float:g_Lines[ ] = { -0.75, -0.735, -0.72, -0.705, -0.69, -0.675 };
  6.  
  7. new const g_Colors[ ][ 3 ] =
  8. {
  9.     { 255, 150, 0 },
  10.     { 255, 0, 255 },
  11.     { 0, 255, 255 },
  12.     { 0, 160, 0 },
  13.     { 0, 120, 255 }
  14. };
  15.  
  16. public plugin_init( )
  17. {
  18.     register_plugin( "AMXX Admin Chat", "0.5b", "Rejack" );
  19.    
  20.     register_clcmd( "say" , "cmdSayChat" );
  21.    
  22.     pCvar   =   register_cvar( "ac_color", "1" );
  23. }
  24.  
  25. public cmdSayChat( client )
  26. {
  27.     new szMsg[ 192 ], szArg[ 24 ];
  28.    
  29.     read_args( szMsg, charsmax( szMsg ) )
  30.    
  31.     read_argv( 1, szArg, charsmax( szArg ) );
  32.    
  33.     remove_quotes( szMsg );
  34.    
  35.     static szName[ 32 ];get_user_name( client, szName, charsmax( szName ) );
  36.    
  37.     if ( get_user_flags( client ) & ADMIN_CHAT )
  38.     {
  39.         if ( szArg[ 0 ] == '@' )
  40.         {
  41.             replace( szMsg, charsmax( szMsg ), "@", "" );
  42.            
  43.             if ( Lines == 5 )   Lines = 0;
  44.            
  45.             new r = random( 255 );
  46.             new g = random( 255 );
  47.             new b = random( 255 );
  48.            
  49.             if ( get_user_flags( client ) & ADMIN_IMMUNITY )
  50.             {
  51.                 if ( get_pcvar_num( pCvar ) == 0 ) set_hudmessage( g_Colors[ 0 ][ 0 ], g_Colors[ 0 ][ 1 ], g_Colors[ 0 ][ 2 ], -0.75, g_Lines[ Lines ], 1, 6.0, 6.0, 0.5, 0.15, -1 );
  52.                
  53.                 else set_hudmessage( r, g, b, -0.75, g_Lines[ Lines ], 1, 6.0, 6.0, 0.5, 0.15, -1 );
  54.                
  55.                 show_hudmessage( 0, "[ Owner ] %s : %s", szName, szMsg );
  56.                
  57.                 Lines += 1;
  58.                
  59.                 return ColorPrint( 0, "[^3 Owner ^1]^4 %s^1 :^3 %s", szName, szMsg );
  60.             }
  61.            
  62.             if ( get_user_flags( client ) & ADMIN_RESERVATION )
  63.             {
  64.                 if ( get_pcvar_num( pCvar ) == 0 ) set_hudmessage( g_Colors[ 1 ][ 0 ], g_Colors[ 1 ][ 1 ], g_Colors[ 1 ][ 2 ], -0.75, g_Lines[ Lines ], 1, 6.0, 6.0, 0.5, 0.15, -1 );
  65.                
  66.                 else set_hudmessage( r, g, b, -0.75, g_Lines[ Lines ], 1, 6.0, 6.0, 0.5, 0.15, -1 );
  67.                
  68.                 show_hudmessage( 0, "[ Manager ] %s : %s", szName, szMsg );
  69.                
  70.                 Lines += 1;
  71.                
  72.                 return ColorPrint( 0, "[^3 Manager ^1]^4 %s^1 :^3 %s", szName, szMsg );
  73.             }
  74.            
  75.             if ( get_user_flags( client ) & ADMIN_BAN )
  76.             {
  77.                 if ( get_pcvar_num( pCvar ) == 0 ) set_hudmessage( g_Colors[ 2 ][ 0 ], g_Colors[ 2 ][ 1 ], g_Colors[ 2 ][ 2 ], -0.75, g_Lines[ Lines ], 1, 6.0, 6.0, 0.5, 0.15, -1 );
  78.                
  79.                 else set_hudmessage( r, g, b, -0.75, g_Lines[ Lines ], 1, 6.0, 6.0, 0.5, 0.15, -1 );
  80.                
  81.                 show_hudmessage( 0, "[ Super-Admin ] %s : %s", szName, szMsg );
  82.                
  83.                 Lines += 1;
  84.                
  85.                 return ColorPrint( 0, "[^3 Super-Admin ^1]^4 %s^1 :^3 %s", szName, szMsg );
  86.             }
  87.            
  88.             if ( get_user_flags( client ) & ADMIN_KICK )
  89.             {
  90.                 if ( get_pcvar_num( pCvar ) == 0 ) set_hudmessage( g_Colors[ 3 ][ 0 ], g_Colors[ 3 ][ 1 ], g_Colors[ 3 ][ 2 ], -0.75, g_Lines[ Lines ], 1, 6.0, 6.0, 0.5, 0.15, -1 );
  91.                
  92.                 else set_hudmessage( r, g, b, -0.75, g_Lines[ Lines ], 1, 6.0, 6.0, 0.5, 0.15, -1 );
  93.                
  94.                 show_hudmessage( 0, "[ Admin ] %s : %s", szName, szMsg );
  95.                
  96.                 Lines += 1;
  97.                
  98.                 return ColorPrint( 0, "[^3 Admin ^1]^4 %s^1 :^3 %s", szName, szMsg );
  99.             }
  100.            
  101.             if ( get_user_flags( client ) & ADMIN_SLAY )
  102.             {
  103.                 if ( get_pcvar_num( pCvar ) == 0 ) set_hudmessage( g_Colors[ 4 ][ 0 ], g_Colors[ 4 ][ 1 ], g_Colors[ 4 ][ 2 ], -0.75, g_Lines[ Lines ], 1, 6.0, 6.0, 0.5, 0.15, -1 );
  104.                
  105.                 else set_hudmessage( r, g, b, -0.75, g_Lines[ Lines ], 1, 6.0, 6.0, 0.5, 0.15, -1 );
  106.                
  107.                 show_hudmessage( 0, "[ VIP ] %s : %s", szName, szMsg );
  108.                
  109.                 Lines += 1;
  110.                
  111.                 return ColorPrint( 0, "[^3 VIP ^1]^4 %s^1 :^3 %s", szName, szMsg );
  112.             }
  113.         }
  114.     }
  115.     return PLUGIN_CONTINUE;
  116. }
  117.  
  118. stock ColorPrint( const client, const string[], any:... )
  119. {
  120.     new msg[ 191 ], players[ 32 ], count = 1;
  121.    
  122.     static len; len = formatex( msg, charsmax( msg ), "^1" );
  123.    
  124.     vformat( msg[ len ], charsmax( msg ) - len, string, 3 );
  125.    
  126.     if( client )  players[ 0 ] = client;
  127.    
  128.     else    get_players( players,count,"ch" );
  129.    
  130.     for ( new i = 0; i < count; i++ )
  131.     {
  132.         if( is_user_connected( players[ i ] ) )
  133.         {
  134.             message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] );
  135.            
  136.             write_byte( players[ i ] );
  137.            
  138.             write_string( msg );
  139.            
  140.             message_end( );
  141.         }
  142.     }
  143.     return PLUGIN_HANDLED;
  144. }
Advertisement
Add Comment
Please, Sign In to add comment