Raised This Month: $ Target: $400
 0% 

Check admin flags


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-27-2014 , 17:06   Re: Check admin flags
Reply With Quote #1

If you ever use a cvar (or any variable) that holds more than 1 flag, your code will still return true when the player has only 1 of the flags, any combination of, or all flags.

Here's an example, see my comments.
PHP Code:
public check_flags(id)
{
    new 
iFlags;
    
iFlags read_flagsget_pcvar_stringflag aflags charsmaxaflags ) ) );

    
//True only if player has ALL flags contained in aflags cvar.
    
if( ( get_user_flagsid ) & iFlags ) == iFlags ); 
    {
        
// my code 
    
}

    
//True if player has AT LEAST ONE (or some, or all) of the flags contained in aflags cvar.
    
if( get_user_flagsid ) & iFlags ); 
    {
        
// my code 
    
}

__________________

Last edited by Bugsy; 07-27-2014 at 17:06.
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 13:12.


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