Advertisement
ObtiMus

Untitled

Aug 3rd, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.15 KB | None | 0 0
  1. #include < amxmodx >
  2.  
  3. enum _:g_mData
  4. {
  5. g_mName[ 32 ],
  6. g_mAccess
  7. };
  8.  
  9. new const szAdmin[ ][ g_mData ] =
  10. {
  11. { "Owner", ADMIN_IMMUNITY },
  12. { "Manager", ADMIN_RESERVATION },
  13. { "Super Admin", ADMIN_LEVEL_G },
  14. { "Admin", ADMIN_BAN },
  15. { "VIP", ADMIN_KICK },
  16. { "Helper", ADMIN_CHAT }
  17. };
  18.  
  19. new const szPrefix[] = "^4[^3xSpot^4]";
  20.  
  21. new pCvar[ 2 ];
  22.  
  23. public plugin_init()
  24. {
  25. register_plugin( "Admins Check", "1.1", "Hohohoho [Edit by iTunes]" );
  26.  
  27. register_saycmd( "admin", "CmdAdmins" );
  28. register_saycmd( "admins", "CmdAdmins" );
  29. register_saycmd( "adminonline", "CmdAdmins" );
  30. register_saycmd( "adminsonline", "CmdAdmins" );
  31. register_saycmd( "adminsonlines", "CmdAdmins" );
  32. register_saycmd( "FlagsOnline", "CmdAdmins" );
  33.  
  34. pCvar[ 0 ] = register_cvar( "admins_online", "1" );
  35. pCvar[ 1 ] = register_cvar( "admins_message", "1" );
  36. pCvar[ 1 ] = register_cvar( "admins_message", "0" );
  37. }
  38.  
  39. public CmdAdmins( client )
  40. {
  41. if ( !get_pcvar_num( pCvar[ 0 ] ) )
  42. return 1;
  43.  
  44. new szText[ 128 ], szMsg[ 512 ], szString[ 2048 ], szOnline[ 512 ], g_iCount, szName[ 32 ], bool: bInContent[ 33 ];static Cvar;
  45.  
  46. Cvar = get_pcvar_num( pCvar[ 1 ] );
  47.  
  48. for ( new j; j < sizeof szAdmin; j++ )
  49. {
  50. g_iCount = 0;
  51.  
  52. szOnline = "";
  53.  
  54. for ( new i = 1; i < get_maxplayers(); i++ )
  55. {
  56. if ( !is_user_connected( i ) || !( get_user_flags( i ) & szAdmin[ j ][ g_mAccess ] ) || bInContent[ i ] )
  57. continue;
  58.  
  59. bInContent[ i ] = true;
  60.  
  61. get_user_name( i, szName, 31 );
  62.  
  63. if ( !Cvar )
  64. formatex( szText, charsmax( szText ), "%s^4%s", (g_iCount > 0 ) ? "^3. " : "", szName );
  65.  
  66. else
  67. formatex( szText, charsmax( szText ), "%s%s", (g_iCount > 0) ? ", " : "", szName );
  68.  
  69. add( szOnline, charsmax( szOnline ), szText );
  70.  
  71. g_iCount++;
  72. }
  73.  
  74. if ( !g_iCount )
  75. {
  76. if ( !Cvar )
  77. ColorPrint( client, "^1No^4 %s's^1 Online.", szAdmin[ j ] );
  78.  
  79. else
  80. formatex( szMsg, charsmax( szMsg ), "No %s's Online.^n", szAdmin[ j ] );
  81. }
  82.  
  83.  
  84. else
  85. {
  86. if ( !Cvar )
  87. ColorPrint( client, "^1Online^4 %s's^1: %s^1.", szAdmin[ j ], szOnline );
  88.  
  89. else
  90. formatex( szMsg, charsmax( szMsg ), "Online %s's: %s.^n", szAdmin[ j ], szOnline );
  91. }
  92.  
  93. if ( Cvar != 0 )
  94. add( szString, charsmax( szString ), szMsg );
  95. }
  96.  
  97. if ( !Cvar )
  98. return 1;
  99.  
  100. set_hudmessage( 151, 255, 255, 0.03, -1.0, 1, 0.0, 8.0, 0.1, 0.1, -1 );
  101.  
  102. show_hudmessage( client, szString );
  103.  
  104. return 1;
  105. }
  106.  
  107. stock ColorPrint( const client, const string[], any:... )
  108. {
  109. new szMsg[ 191 ], Players[ 32 ], PNum = 1;
  110.  
  111. static iLen; iLen = formatex( szMsg, charsmax( szMsg ), "%s ", szPrefix );
  112.  
  113. vformat( szMsg[ iLen ], charsmax( szMsg ) - iLen, string, 3 );
  114.  
  115. if ( client )
  116. Players[ 0 ] = client;
  117.  
  118. else
  119. get_players( Players, PNum, "ch" );
  120.  
  121. for ( new i; i < PNum; i++ )
  122. {
  123. if( is_user_connected( Players[ i ] ) )
  124. {
  125. message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, Players[ i ] );
  126.  
  127. write_byte( Players[ i ] );
  128.  
  129. write_string( szMsg );
  130.  
  131. message_end( );
  132. }
  133. }
  134.  
  135. return 1;
  136. }
  137.  
  138. stock register_saycmd( szCommand[], szHandler[] )
  139. {
  140. new szSayType[][] = { "say", "say_team" }, szSigns[][] = { "/", "!", "." }, szSayItem[ 128 ];
  141.  
  142. for ( new i; i < sizeof szSayType; i++ )
  143. {
  144. for ( new j; j < sizeof szSigns; j++ )
  145. {
  146. formatex( szSayItem, 127, "%s %s%s", szSayType[ i ], szSigns[ j ], szCommand );
  147.  
  148. register_clcmd( szSayItem, szHandler );
  149. }
  150. }
  151. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement