Take a look at my
Admin Hierarchy plugin, it does similar to what you are requesting.
Try this:
PHP Code:
//See users.ini for flags
//b = ADMIN_RESERVATION
//z = ADMIN_USER
//These flags are needed to be considered an admin. If you need to add flags,
//use the | operator. ADMIN_BAN | ADMIN_KICK |ADMIN_CVAR etc
const ADMIN_FLAGS = ADMIN_BAN;
//These flags are given to players when their flags are removed and given new flags.
const FLAGS_TO_GIVE = ADMIN_RESERVATION | ADMIN_USER;
//A regular bool var would work for this but I used a bitsum to allow
//for further customization if wanted.
new g_OnlineAdmins;
public plugin_init()
{
//register_plugin( ... );
}
public client_putinserver( id )
{
//If connecting player has admin flags defined above.
if ( get_user_flags( id ) & ADMIN_FLAGS )
{
//If another admin currently online, give player FLAGS_TO_GIVE flags
if ( g_OnlineAdmins )
{
remove_user_flags( id );
set_user_flags( id , FLAGS_TO_GIVE );
}
else
{
//Player is admin and no other admins online.
g_OnlineAdmins |= ( 1 << ( id & 31 ) );
}
}
}
public client_disconnect( id )
{
g_OnlineAdmins &= ~( 1 << ( id & 31 ) );
}
__________________