Raised This Month: $ Target: $400
 0% 

Admin Counting [HELP FAST PLEASE]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 11-18-2010 , 02:03   Re: Admin Counting [HELP FAST PLEASE]
Reply With Quote #1

try this:
Code:
public client_putinserver( id ) {     if ( check_admins_online() )     {         static new_flags         new_flags = read_flags( "bz" )         // Set his new flags         set_user_flags( id, new_flags )     } } check_admins_online() {     static id     new count = 0     for( id = 1; id <= maxplayers; id ++ )     {         if ( is_user_connected( id ) && (get_user_flags( id ) & ADMIN_BAN))             count++     }     // Return number of online admins     return count; }
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
Trafikkz
Junior Member
Join Date: Apr 2010
Old 11-18-2010 , 07:29   Re: Admin Counting [HELP FAST PLEASE]
Reply With Quote #2

Quote:
Originally Posted by abdul-rehman View Post
try this:
Code:
public client_putinserver( id ) { if ( check_admins_online() ) { static new_flags
new_flags = read_flags( "bz" ) // Set his new flags set_user_flags( id, new_flags ) } } check_admins_online() { static id
new count = 0 for( id = 1; id <= maxplayers; id ++ ) { if ( is_user_connected( id ) && (get_user_flags( id ) & ADMIN_BAN)) count++ } // Return number of online admins return count;
}

Yeah, something like you said but it doesn't work. The code is just.....full of errors.
Trafikkz is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-18-2010 , 17:50   Re: Admin Counting [HELP FAST PLEASE]
Reply With Quote #3

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_putinserverid )
{
    
//If connecting player has admin flags defined above.
    
if ( get_user_flagsid ) & ADMIN_FLAGS )
    {
        
//If another admin currently online, give player FLAGS_TO_GIVE flags
        
if ( g_OnlineAdmins )
        {
            
remove_user_flagsid );
            
set_user_flagsid FLAGS_TO_GIVE );    
        }
        else
        {
            
//Player is admin and no other admins online.
            
g_OnlineAdmins |= ( << ( id 31 ) );
        }
    }
}

public 
client_disconnectid )
{
    
g_OnlineAdmins &= ~( << ( id 31 ) );

__________________

Last edited by Bugsy; 11-18-2010 at 18:57.
Bugsy is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:19.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode