Raised This Month: $ Target: $400
 0% 

Function Has_Flag Explication


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
. ThePro
Junior Member
Join Date: Dec 2011
Old 12-23-2011 , 06:55   Function Has_Flag Explication
Reply With Quote #1

Hello Members AlliedModders,
Can anyone explain the use of the function: if (has_flag (id, ""))

PS:
Please, tell me if I posted in the right area.

Last edited by . ThePro; 12-23-2011 at 06:57.
. ThePro is offline
. ThePro
Junior Member
Join Date: Dec 2011
Old 12-23-2011 , 06:57   Re: Function Has_Flag Explication
Reply With Quote #2

Double Post, Sorry, I did not know the function of the "Quick List".

Last edited by . ThePro; 12-23-2011 at 06:57.
. ThePro is offline
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 12-23-2011 , 11:49   Re: Function Has_Flag Explication
Reply With Quote #3

http://www.amxmodx.org/funcwiki.php?go=all_func
__________________
joshknifer is offline
Send a message via Skype™ to joshknifer
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-23-2011 , 12:18   Re: Function Has_Flag Explication
Reply With Quote #4

Quote:
Originally Posted by . ThePro View Post
Hello Members AlliedModders,
Can anyone explain the use of the function:[B] if (has_flag (id, ""))
amxmisc.inc
Code:
/* Returns true if the user has ANY of the provided flags
 * false if they have none 
 */
stock has_flag(id, const flags[]) 
{
	return (get_user_flags(id) & read_flags(flags));
}
Quote:
Originally Posted by . ThePro View Post
Double Post, Sorry, I did not know the function of the "Quick List".
What is a "Quick List"?
__________________
fysiks is offline
. ThePro
Junior Member
Join Date: Dec 2011
Old 12-23-2011 , 13:07   Re: Function Has_Flag Explication
Reply With Quote #5

joshknifer, Thanks buddy, I'll take a look.
fysiks, So if I use it's fine, see the example in a menu:

Quote:
public Cmd_Forum(id)
{
if(has_Used[id])
return HAM_IGNORED

if (has_flag(id, "a"))
{
new menu = menu_create("\yDescription","ShowMenuPlayer", 0)
menu_additem(menu,"\r\wDescription Case","1",0,-1)
}
return PLUGIN_HANDLED;
}
. ThePro is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-23-2011 , 13:12   Re: Function Has_Flag Explication
Reply With Quote #6

Quote:
Originally Posted by . ThePro View Post
joshknifer, Thanks buddy, I'll take a look.
fysiks, So if I use it's fine, see the example in a menu:

PHP Code:
public Cmd_Forum(id)
{
    if(
has_Used[id])
        return 
HAM_IGNORED

    
if(has_flag(id"a"))
    {
        new 
menu menu_create("\yDescription","ShowMenuPlayer"0)
        
menu_additem(menu,"\r\wDescription Case","1",0,-1)
    }
    return 
PLUGIN_HANDLED

If you use it with only one flag then it's the same as, but less efficient than, using:

PHP Code:
if( get_user_flags(id) & ADMIN_IMMUNITY 
Tip: Don't use HAM_ return values unless it is inside a Ham function. You should use PLUGIN_HANDLED where you are currently using a Ham return value.
__________________
fysiks is offline
. ThePro
Junior Member
Join Date: Dec 2011
Old 12-27-2011 , 11:37   Re: Function Has_Flag Explication
Reply With Quote #7

A friend, I understand how to use, thanks.
. ThePro 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:44.


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