AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Custom acces flags (https://forums.alliedmods.net/showthread.php?t=206552)

TedMan 01-23-2013 21:51

Custom acces flags
 
How i can make a custom flag like X,Y,V. I want to make a small vip plugin with one of these flags. :)

fysiks 01-23-2013 22:10

Re: Custom acces flags
 
Look in amxconst.inc and just continue the pattern. But, don't modify the include, you can just use a similar definition at the top of your plugin.

tre3fla 01-27-2013 21:46

Re: Custom acces flags
 
something like this ?

PHP Code:

#define ADMIN_CUSTOM        (1<<26) 


fysiks 01-27-2013 22:34

Re: Custom acces flags
 
Quote:

Originally Posted by tre3fla (Post 1882035)
something like this ?

PHP Code:

#define ADMIN_CUSTOM        (1<<26) 


No, there does not exist 27 letters in the alphabet. I said continue the pattern for the letters that you want to use.

ConnorMcLeod 01-28-2013 01:33

Re: Custom acces flags
 
Code:

#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_ADMIN                (1<<24)        /* flag "y" */

->

Code:

#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_LEVEL_I                (1<<21)        /* flag "v" */
#define ADMIN_LEVEL_J                (1<<22)        /* flag "w" */
#define ADMIN_LEVEL_K                (1<<23)        /* flag "x" */
#define ADMIN_ADMIN                (1<<24)        /* flag "y" */


But you should have enough with already existing ADMIN_LEVEL_ flags and combining them.

Exemple : ADMIN_LEVEL_A | ADMIN_LEVEL_D
ADMIN_LEVEL_B | ADMIN_LEVEL_D
ADMIN_LEVEL_A | ADMIN_LEVEL_D | ADMIN_LEVEL_G | ADMIN_LEVEL_H

fysiks 01-28-2013 01:49

Re: Custom acces flags
 
Quote:

Originally Posted by ConnorMcLeod (Post 1882112)
and combining them.

Exemple : ADMIN_LEVEL_A | ADMIN_LEVEL_D
ADMIN_LEVEL_B | ADMIN_LEVEL_D
ADMIN_LEVEL_A | ADMIN_LEVEL_D | ADMIN_LEVEL_G | ADMIN_LEVEL_H

Just want to point out that combining flags like this isn't the equivalent of creating the a new unique flag.

I am curious as to why the developers would exclude those three in AMX Mod X. You already have 89% of them defined already so why not just do them all? No harm done if they are there.

ConnorMcLeod 01-28-2013 12:49

Re: Custom acces flags
 
May be it was reserved for something in the future ?
Also, flag system allows 32 * 32 flags, only 1*32 is used, why ?

fysiks 01-28-2013 20:24

Re: Custom acces flags
 
Quote:

Originally Posted by ConnorMcLeod (Post 1882350)
May be it was reserved for something in the future ?
Also, flag system allows 32 * 32 flags, only 1*32 is used, why ?

I didn't know that. How are these other flags identified as strings?

ConnorMcLeod 01-29-2013 01:25

Re: Custom acces flags
 
Code:

/* Sets the users flags with the assignment by bitwise OR operator. */
native set_user_flags(index,flags=-1,id=0);

/* Gets flags from player. Set index to 0 if you want to read flags from server. */
native get_user_flags(index,id=0);

Consider 'id' variable as a slot, and consider there are 32 slots, each slot can contain flags from 1<<0 to 1<<31.
I'm still wondering why plugins like VIP plugins or admins deference don't use such system, would just require a little api so at plugin_cfg you could pick a free slot :)

fysiks 01-29-2013 01:48

Re: Custom acces flags
 
Quote:

Originally Posted by ConnorMcLeod (Post 1882740)
Code:

/* Sets the users flags with the assignment by bitwise OR operator. */
native set_user_flags(index,flags=-1,id=0);

/* Gets flags from player. Set index to 0 if you want to read flags from server. */
native get_user_flags(index,id=0);

Consider 'id' variable as a slot, and consider there are 32 slots, each slot can contain flags from 1<<0 to 1<<31.
I'm still wondering why plugins like VIP plugins or admins deference don't use such system, would just require a little api so at plugin_cfg you could pick a free slot :)

Ok but I was asking about reading flags from a string with read_flags(). My question was regarding making them work with cmdaccess.ini which uses read_flags().


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

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