Raised This Month: $32 Target: $400
 8% 

Reading flags


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 11-16-2020 , 13:17   Reading flags
Reply With Quote #1

Hello, i have just stuck at one place which i dont know how to fix.
So the problem is when i make myself admin + vip at the same time it still shows me old cdefiju flags when i try to show it with hud message. But in server im hcdefiju flag user. Anyone knows how to fix that?

PHP Code:
new flags_user read_flags("z")
    new 
flags_vip read_flags("h")
    new 
flags_admin read_flags("cdefiju")
        new 
flags_vip_admin read_flags("hcdefiju")
    if( 
get_user_flagsid ) & flags_user )
    {
     
// code here
    
}
    else if( 
get_user_flagsid ) & flags_vip )
    {
     
// code here
    
}
    else if( 
get_user_flagsid ) & flags_admin )
    {
     
// code here
    
}
    else if( 
get_user_flagsid ) & flags_vip_admin )
    {
 
// code here
    


Last edited by HowToRuski; 11-16-2020 at 13:18.
HowToRuski is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-16-2020 , 13:28   Re: Reading flags
Reply With Quote #2

That method checks if the player has AT LEAST ONE of the provided flags.
To check if the player has ALL of the flags, you would need to do:

Code:
if(get_user_flags(id) & flags == flags)

Or simply use the "has_all_flags" stock from "amxmisc".
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 11-16-2020 , 13:29   Re: Reading flags
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
That method checks if the player has AT LEAST ONE of the provided flags.
To check if the player has ALL of the flags, you would need to do:

Code:
if(get_user_flags(id) & flags == flags)

Or simply use the "has_all_flags" stock from "amxmisc".
So what does your code mean? Just asking about that ==

EDIT: used your idea(also has_all_flags), it checks for the very first flag it has and didnt solve...

Last edited by HowToRuski; 11-16-2020 at 13:37.
HowToRuski is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-16-2020 , 13:51   Re: Reading flags
Reply With Quote #4

That can't be right. Show the full code.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-16-2020 , 22:34   Re: Reading flags
Reply With Quote #5

OxiXCrom is right, you are doing something wrong. Maybe using && instead of &?

PHP Code:
if ( ( flags_player_has flags_to_check_for ) == flags_to_check_for )
{
     
//player has all flags_to_check_for flags, and possibly more flags

__________________
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 22:15.


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