AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Function Has_Flag Explication (https://forums.alliedmods.net/showthread.php?t=174641)

. ThePro 12-23-2011 06:55

Function Has_Flag Explication
 
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.

. ThePro 12-23-2011 06:57

Re: Function Has_Flag Explication
 
Double Post, Sorry, I did not know the function of the "Quick List".

joshknifer 12-23-2011 11:49

Re: Function Has_Flag Explication
 
http://www.amxmodx.org/funcwiki.php?go=all_func

fysiks 12-23-2011 12:18

Re: Function Has_Flag Explication
 
Quote:

Originally Posted by . ThePro (Post 1618238)
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 (Post 1618240)
Double Post, Sorry, I did not know the function of the "Quick List".

What is a "Quick List"?

. ThePro 12-23-2011 13:07

Re: Function Has_Flag Explication
 
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;
}

fysiks 12-23-2011 13:12

Re: Function Has_Flag Explication
 
Quote:

Originally Posted by . ThePro (Post 1618442)
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.

. ThePro 12-27-2011 11:37

Re: Function Has_Flag Explication
 
A friend, I understand how to use, thanks.


All times are GMT -4. The time now is 20:44.

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