Raised This Month: $ Target: $400
 0% 

~get_user_flags(id) & read_flags(flag) dosn't work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 04-21-2015 , 16:31   ~get_user_flags(id) & read_flags(flag) dosn't work
Reply With Quote #1

Why such use as in title of topic doesn't work?

Example:
PHP Code:
#define userFlags(%0,%1) get_user_flags(%0) & read_flags(%1)

public TakeDamage(identattackerFloat:damage) {
    if(!
is_user_connected(id) || !is_user_connected(attacker) || ~userFlags(attacker"s, v") || get_user_team(attacker) != 2) return 1;

    if(
GetUserWeapon(attacker) == 28 || GetUserWeapon(attacker) == 22) {
        
SetHamParamFloat(4damage 2.0);
        return 
2;
    }
    return 
1;


Last edited by OnePL; 04-21-2015 at 16:34.
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
Bos93
Veteran Member
Join Date: Jul 2010
Old 04-21-2015 , 17:22   Re: ~get_user_flags(id) & read_flags(flag) dosn't work
Reply With Quote #2

~userFlags(attacker, "sv")
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
OnePL
BANNED
Join Date: May 2012
Location: GB
Old 04-21-2015 , 17:39   Re: ~get_user_flags(id) & read_flags(flag) dosn't work
Reply With Quote #3

No. Then the player will have to have both flags.
, = or in read_flags

!(userFlags(attacker, "s, v")) working
~userFlags(attacker, "s, v")) not working

Last edited by OnePL; 04-21-2015 at 17:40.
OnePL is offline
Send a message via ICQ to OnePL Send a message via AIM to OnePL Send a message via Yahoo to OnePL Send a message via Skype™ to OnePL
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 04-21-2015 , 20:15   Re: ~get_user_flags(id) & read_flags(flag) dosn't work
Reply With Quote #4

lets say that the "attacker" has both flags and userFlags macro returns 4 (binary 0100)

! is a logical operator. !4 will result false
~ is a bitwise operator. ~0100 will result in 1011 (decimal 11) and that is still considered true in the if statement
jimaway is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-23-2015 , 20:28   Re: ~get_user_flags(id) & read_flags(flag) dosn't work
Reply With Quote #5

Use has_all_flags()

In your case, you would use !has_all_flags( id , "sv" )
__________________

Last edited by Bugsy; 04-23-2015 at 20:32.
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 20:18.


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