Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Description:
- When a player write for example: /admins
- It will show all the online admins on the server sort by access level.
- * Credit:
- Rejack
- * Change Log:
- * v1.0: First built the plugin.
- * v1.1:
- * Added Cvars to:
- - Disable or Enable the plugin.
- - Change between ColorChat msg to Hud msg.
- */
- #include < amxmodx >
- enum _:g_mData
- {
- g_mName[ 32 ],
- g_mAccess
- };
- #define WITH_SUPER_ADMIN
- new const szAdmin[ ][ g_mData ] =
- {
- { "Owner", ADMIN_RCON },
- { "Manager", ADMIN_IMMUNITY },
- #if defined WITH_SUPER_ADMIN
- { "Super Admin", ADMIN_BAN },
- #endif
- { "Admin", ADMIN_KICK },
- { "VIP", ADMIN_SLAY }
- };
- new const szPrefix[] = "^4[AMXX]^1";
- new pCvar[ 2 ];
- public plugin_init()
- {
- register_plugin( "Admins Online", "1.1", "Rejack" );
- register_saycmd( "admin", "CmdAdmins" );
- register_saycmd( "admins", "CmdAdmins" );
- pCvar[ 0 ] = register_cvar( "admins_online", "1" );
- pCvar[ 1 ] = register_cvar( "admins_message", "0" ); /* 0 = Chat | 1 = Hudmessage */
- }
- public CmdAdmins( client )
- {
- if ( !get_pcvar_num( pCvar[ 0 ] ) )
- return 1;
- new szText[ 128 ], szMsg[ 512 ], szString[ 2048 ], szOnline[ 512 ], g_iCount, szName[ 32 ], bool: bInContent[ 33 ];static Cvar;
- Cvar = get_pcvar_num( pCvar[ 1 ] );
- for ( new j; j < sizeof szAdmin; j++ )
- {
- g_iCount = 0;
- szOnline = "";
- for ( new i = 1; i < get_maxplayers(); i++ )
- {
- if ( !is_user_connected( i ) || !( get_user_flags( i ) & szAdmin[ j ][ g_mAccess ] ) || bInContent[ i ] )
- continue;
- bInContent[ i ] = true;
- get_user_name( i, szName, 31 );
- if ( !Cvar )
- formatex( szText, charsmax( szText ), "%s^4%s", (g_iCount > 0 ) ? "^3. " : "", szName );
- else
- formatex( szText, charsmax( szText ), "%s%s", (g_iCount > 0) ? ", " : "", szName );
- add( szOnline, charsmax( szOnline ), szText );
- g_iCount++;
- }
- if ( !g_iCount )
- {
- if ( !Cvar )
- ColorPrint( client, "^3No^4 %s's^3 Online^1.", szAdmin[ j ] );
- else
- formatex( szMsg, charsmax( szMsg ), "No %s's Online.^n", szAdmin[ j ] );
- }
- else
- {
- if ( !Cvar )
- ColorPrint( client, "^3Online^4 %s's^1: %s^1.", szAdmin[ j ], szOnline );
- else
- formatex( szMsg, charsmax( szMsg ), "Online %s's: %s.^n", szAdmin[ j ], szOnline );
- }
- if ( Cvar != 0 )
- add( szString, charsmax( szString ), szMsg );
- }
- if ( !Cvar )
- return 1;
- set_hudmessage( 255, 0, 0, 0.03, -1.0, 1, 0.0, 8.0, 0.1, 0.1, -1 );
- show_hudmessage( client, szString );
- return 1;
- }
- stock ColorPrint( const client, const string[], any:... )
- {
- new szMsg[ 191 ], Players[ 32 ], PNum = 1;
- static iLen; iLen = formatex( szMsg, charsmax( szMsg ), "%s ", szPrefix );
- vformat( szMsg[ iLen ], charsmax( szMsg ) - iLen, string, 3 );
- if ( client )
- Players[ 0 ] = client;
- else
- get_players( Players, PNum, "ch" );
- for ( new i; i < PNum; i++ )
- {
- if( is_user_connected( Players[ i ] ) )
- {
- message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, Players[ i ] );
- write_byte( Players[ i ] );
- write_string( szMsg );
- message_end( );
- }
- }
- return 1;
- }
- stock register_saycmd( szCommand[], szHandler[] )
- {
- new szSayType[][] = { "say", "say_team" }, szSigns[][] = { "/", "!", "." }, szSayItem[ 128 ];
- for ( new i; i < sizeof szSayType; i++ )
- {
- for ( new j; j < sizeof szSigns; j++ )
- {
- formatex( szSayItem, 127, "%s %s%s", szSayType[ i ], szSigns[ j ], szCommand );
- register_clcmd( szSayItem, szHandler );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement