AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Other flags? (https://forums.alliedmods.net/showthread.php?t=330187)

Theodore Bagwell 01-23-2021 13:13

Other flags?
 
Hi. I know there are no flags like x, wy, v in amxmod x. Therefore, plug-ins cannot be set on them. But I have seen servers that have some of these plugins with these flags? how is it possible? Is this possible to do so?

I tried
PHP Code:

    if( !has_flagid"x" ) )
    {
        return 
PLUGIN_HANDLED;
    } 

But I do not know if this is true or not.

Shadows Adi 01-23-2021 13:35

Re: Other flags?
 
Quote:

Originally Posted by Theodore Bagwell (Post 2733953)
Hi. I know there are no flags like x, wy, v in amxmod x. Therefore, plug-ins cannot be set on them. But I have seen servers that have some of these plugins with these flags? how is it possible? Is this possible to do so?

I tried
PHP Code:

    if( !has_flagid"x" ) )
    {
        return 
PLUGIN_HANDLED;
    } 

But I do not know if this is true or not.

Well, check it by yourself:
PHP Code:

// In plugin_init() we register our test func
register_clcmd("amx_test""clcmd_test")

// Testing if client has or not flag "x"
public clcmd_test(id)
{
    if(
has_flag(id"x"))
    {
        
client_print(idprint_chat"You have flag ^"x^"")
    }
    else 
    {
        
client_print(idprint_chat"You don't have flag ^"x^"")
    }


And about "there are no flag like w or x", it exists, but are not defined by default. To access bitsum value of flag:
PHP Code:

(1<<22/* flag "w" */
(1<<23/* flag "x" */ 


OciXCrom 01-23-2021 13:36

Re: Other flags?
 
This is the current list of flags:

Code:
#define ADMIN_ALL           0       /* everyone */ #define ADMIN_IMMUNITY      (1<<0)  /* flag "a" */ #define ADMIN_RESERVATION   (1<<1)  /* flag "b" */ #define ADMIN_KICK          (1<<2)  /* flag "c" */ #define ADMIN_BAN           (1<<3)  /* flag "d" */ #define ADMIN_SLAY          (1<<4)  /* flag "e" */ #define ADMIN_MAP           (1<<5)  /* flag "f" */ #define ADMIN_CVAR          (1<<6)  /* flag "g" */ #define ADMIN_CFG           (1<<7)  /* flag "h" */ #define ADMIN_CHAT          (1<<8)  /* flag "i" */ #define ADMIN_VOTE          (1<<9)  /* flag "j" */ #define ADMIN_PASSWORD      (1<<10) /* flag "k" */ #define ADMIN_RCON          (1<<11) /* flag "l" */ #define ADMIN_LEVEL_A       (1<<12) /* flag "m" */ #define ADMIN_LEVEL_B       (1<<13) /* flag "n" */ #define ADMIN_LEVEL_C       (1<<14) /* flag "o" */ #define ADMIN_LEVEL_D       (1<<15) /* flag "p" */ #define ADMIN_LEVEL_E       (1<<16) /* flag "q" */ #define ADMIN_LEVEL_F       (1<<17) /* flag "r" */ #define ADMIN_LEVEL_G       (1<<18) /* flag "s" */ #define ADMIN_LEVEL_H       (1<<19) /* flag "t" */ #define ADMIN_MENU          (1<<20) /* flag "u" */ #define ADMIN_BAN_TEMP      (1<<21) /* flag "v" */ #define ADMIN_ADMIN         (1<<24) /* flag "y" */ #define ADMIN_USER          (1<<25) /* flag "z" */

As you can see, the 2 that are missing can easily be added.

Code:
#define ADMIN_FLAG_W (1<<22) /* flag "w" */ #define ADMIN_SUPER (1<<23) /* flag "x" */

Or whatever you want to name them.

Either add them in your .sma, or in some .inc file.
If you don't need to use the constants, "has_flag" works just fine.
You can also use them in cmdaccess.ini or users.ini without any problems.

Theodore Bagwell 01-23-2021 14:13

Re: Other flags?
 
Thank you guys! It helped a lot.


All times are GMT -4. The time now is 15:07.

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