Advertisement
Rejack

Admins Chat (v1.0)

Jul 24th, 2013 (edited)
491
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.21 KB | None | 0 0
  1. #include < amxmodx >
  2.  
  3. new Float:xPos[ 3 ] = { 0.05, -1.0, -1.0 };
  4.  
  5. new Float:yPos[ 3 ] = { 0.55, 0.2, 0.7 };
  6.  
  7. new g_iLine[ 3 ];
  8.  
  9. new g_iAccess[ ] = { ADMIN_RCON, ADMIN_IMMUNITY, ADMIN_BAN, ADMIN_KICK, ADMIN_SLAY };
  10.  
  11. new szAccess[ ][ ] = { "Owner", "Manager", "Super Admin", "Admin", "VIP" };
  12.  
  13. new g_Colors[ ][ ] = { { 255, 255, 255 },{ 255, 0, 0 },{ 0, 255, 0 },{ 0, 0, 255 },{ 255, 255, 0 },{ 255, 0, 255 },{ 0, 255, 255 },{ 277, 96, 8 },{ 45, 89, 116 },{ 103, 44, 38 } };
  14.  
  15. new szColors[ ][ ] = { "", "r", "g", "b", "y", "m", "c", "o" };
  16.  
  17. public plugin_init()
  18. {
  19.     register_plugin( "Admins Chat", "1.0", "Rejack" );
  20.    
  21.     register_clcmd( "say", "CmdSay" );
  22. }
  23.  
  24. public CmdSay( client )
  25. {
  26.     if ( !( get_user_flags( client ) & ADMIN_CHAT ) )
  27.         return 0;
  28.    
  29.     new szSigns[ 6 ], i = 0;
  30.    
  31.     read_argv( 1, szSigns, charsmax( szSigns ) );
  32.    
  33.     while ( szSigns[ i ] == '@' )
  34.         i++;
  35.    
  36.     if ( !i || i > 3 )
  37.         return 0;
  38.    
  39.     new c = 0;
  40.    
  41.     switch( szSigns[ i ] )
  42.     {
  43.         case 'r': c = 1
  44.         case 'g': c = 2
  45.         case 'b': c = 3
  46.         case 'y': c = 4
  47.         case 'm': c = 5
  48.         case 'c': c = 6
  49.         case 'o': c = 7
  50.     }
  51.    
  52.     new szMsg[ 192 ];
  53.    
  54.     read_args( szMsg, charsmax( szMsg ) );
  55.    
  56.     remove_quotes( szMsg );
  57.    
  58.     for ( new j; j < i; j++ )
  59.         replace( szMsg, charsmax( szMsg ), "@", "" );
  60.    
  61.     if ( c )
  62.         replace( szMsg, charsmax( szMsg ), szColors[ c ], "" );
  63.    
  64.     set_hudmessage( g_Colors[ c ][ 0 ], g_Colors[ c ][ 1 ], g_Colors[ c ][ 2 ], xPos[ i - 1 ], yPos[ i - 1 ], 0, 0.0, 8.0, 0.1, 0.1, -1 );
  65.    
  66.     g_iLine[ i - 1 ]++;
  67.    
  68.     new szLines[ 32 ];
  69.    
  70.     for ( new o = 0; o < g_iLine[ i - 1 ]; o++ )
  71.         add( szLines, charsmax( szLines ), "^n" );
  72.    
  73.     show_hudmessage( 0, "%s(%s) %s: %s", szLines, GetUserTag( client ), GetUserName( client ), szMsg );
  74.    
  75.     if ( g_iLine[ i - 1 ] == 4 )
  76.         g_iLine[ i - 1 ] = 0;
  77.    
  78.     return 1;
  79. }
  80.  
  81. stock GetUserName( const index )
  82. {
  83.     static Name[ 128 ];
  84.    
  85.     get_user_name( index, Name, charsmax( Name ) );
  86.    
  87.     return Name;
  88. }
  89.  
  90. stock GetUserTag( const index )
  91. {
  92.     new g_szAccess[ 12 ];
  93.    
  94.     for ( new i; i < sizeof szAccess; i++ )
  95.     {
  96.         if ( get_user_flags( index ) & g_iAccess[ i ] )
  97.         {
  98.             formatex( g_szAccess, charsmax( g_szAccess ), "%s", szAccess[ i ] );
  99.            
  100.             break;
  101.         }
  102.     }
  103.    
  104.     return g_szAccess;
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement