Raised This Month: $ Target: $400
 0% 

Custom acces flags


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TedMan
Senior Member
Join Date: Oct 2012
Old 01-23-2013 , 21:51   Custom acces flags
Reply With Quote #1

How i can make a custom flag like X,Y,V. I want to make a small vip plugin with one of these flags.
TedMan is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-23-2013 , 22:10   Re: Custom acces flags
Reply With Quote #2

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.
__________________
fysiks is offline
tre3fla
Member
Join Date: Jul 2012
Old 01-27-2013 , 21:46   Re: Custom acces flags
Reply With Quote #3

something like this ?

PHP Code:
#define ADMIN_CUSTOM        (1<<26) 
tre3fla is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-27-2013 , 22:34   Re: Custom acces flags
Reply With Quote #4

Quote:
Originally Posted by tre3fla View Post
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.
__________________
fysiks is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-28-2013 , 01:33   Re: Custom acces flags
Reply With Quote #5

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
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-28-2013 , 01:49   Re: Custom acces flags
Reply With Quote #6

Quote:
Originally Posted by ConnorMcLeod View Post
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.
__________________
fysiks is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-28-2013 , 12:49   Re: Custom acces flags
Reply With Quote #7

May be it was reserved for something in the future ?
Also, flag system allows 32 * 32 flags, only 1*32 is used, why ?
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 01-28-2013 at 12:50.
ConnorMcLeod is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-28-2013 , 20:24   Re: Custom acces flags
Reply With Quote #8

Quote:
Originally Posted by ConnorMcLeod View Post
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?
__________________
fysiks is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-29-2013 , 01:25   Re: Custom acces flags
Reply With Quote #9

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
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-29-2013 , 01:48   Re: Custom acces flags
Reply With Quote #10

Quote:
Originally Posted by ConnorMcLeod View Post
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().
__________________
fysiks is offline
Reply


Thread Tools
Display Modes

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:32.


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