ColdWar-Pawn

Admins Check - No Super Admin

Mar 17th, 2013
739
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.49 KB | None | 0 0
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4.  
  5.  
  6. enum _:Admins
  7. {
  8.     Owner,
  9.     Manager,
  10.     Admin,
  11.     VIP
  12. }
  13.  
  14. enum _:AdminLevel
  15. {
  16.     Name[8],
  17.     Flag
  18. }
  19.  
  20. new const szAdmins[ Admins ][ AdminLevel ] = {
  21.     { "Owner", ADMIN_IMMUNITY },
  22.     { "Manager", ADMIN_RESERVATION },
  23.     { "Admin", ADMIN_BAN },
  24.     { "VIP", ADMIN_KICK }
  25. }
  26.  
  27. public plugin_init() {
  28.     register_plugin( "Admins Check", "v0.0.1", "+ColdWar" )
  29.    
  30.     register_saycmd( "admin", "CmdAdmins" );
  31.     register_saycmd( "admins", "CmdAdmins" );
  32. }
  33.  
  34. public CmdAdmins( client )
  35. {
  36.     new bool: g_bAdded[33], szString[ 200 ], g_iCounter, szName[ 32 ];
  37.     for ( new i = 0 ; i < Admins ; i ++ )
  38.     {
  39.         g_iCounter = 0
  40.         szString = ""
  41.         for( new j = 1; j < get_maxplayers () ; j ++ )
  42.         {
  43.             if( ! is_user_connected( j ) )
  44.                 continue ;
  45.             if( get_user_flags( j ) & szAdmins[ i ][ Flag ] )
  46.             {
  47.                 if( g_bAdded[ j ] )
  48.                     continue;
  49.                 g_bAdded[ j ] = true
  50.                 if( g_iCounter )
  51.                     add( szString, charsmax( szString ), "^1,^3 " )
  52.                 g_iCounter ++
  53.                 get_user_name( j, szName, sizeof szName - 1 );
  54.                 add( szString, charsmax( szString ), szName );
  55.             }
  56.            
  57.         }  
  58.        
  59.         add( szString, charsmax( szString ), "^1." )   
  60.         if( !g_iCounter )
  61.             ColorChat( client, "^1No ^3%ss^1 Online.", szAdmins[ i ][ Name ] )
  62.         else
  63.             ColorChat( client, "^1%ss Online^1:^3 %s", szAdmins[ i ][ Name ], szString )
  64.     }
  65. }
  66.  
  67. stock register_saycmd( const cmd[], const function[], flags = -1, const info[] = "", FlagManager = -1 )
  68. {
  69.     new i, j;
  70.     new szString[ 64 ];
  71.     new const szSayTypes[ ][ ] = { "say", "say_team" };
  72.     new const szTypes[ ][ ] = { "", "/", "!", "." };
  73.     for( i = 0 ; i < sizeof szSayTypes ; i ++ )
  74.     {
  75.         for( j = 0 ; j < sizeof szTypes ; j ++ )
  76.         {
  77.             formatex( szString, sizeof szString - 1, "%s %s%s", szSayTypes[ i ], szTypes[ j ], cmd );
  78.             register_clcmd( szString, function, flags, info, FlagManager );
  79.         }
  80.     }
  81. }
  82.  
  83. stock ColorChat(index, const Msg[], any:... ) {
  84.     new Buffer[190], Buffer2[192]
  85.     formatex(Buffer2, sizeof(Buffer2)-1, "^4[AMXX]^1 %s", Msg)
  86.     vformat(Buffer, sizeof(Buffer)-1, Buffer2, 3)
  87.     if(!index)
  88.     {
  89.         for (new i = 1; i <= get_maxplayers(); i++)
  90.         {
  91.             if(!is_user_connected(i))  
  92.                 continue
  93.             message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, i)
  94.             write_byte(i)
  95.             write_string(Buffer)
  96.             message_end()
  97.         }
  98.     }
  99.     else
  100.     {
  101.         if(!is_user_connected(index))  
  102.             return
  103.         message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, index)
  104.         write_byte(index)
  105.         write_string(Buffer)
  106.         message_end()
  107.     }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment