Raised This Month: $ Target: $400
 0% 

Question about admin flags stored as cvars


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mugwump
Senior Member
Join Date: May 2004
Old 10-01-2004 , 09:40   Question about admin flags stored as cvars
Reply With Quote #1

Can admin access flags be stored as cvars by their defined identifier names from amxconst ?

e.g. I am wondering if the following would work?

Code:
register_cvar( "access_level", "ADMIN_LEVEL_A") ... if ( !(get_user_flags(id) & get_cvar_num("access_level") ) {    // No access    return PLUGIN_HANDLED }

If not, how would this need to be handled?

Thanks!
-Mug
Mugwump is offline
devicenull
Veteran Member
Join Date: Mar 2004
Location: CT
Old 10-01-2004 , 15:26  
Reply With Quote #2

No, here's what you do.
Take the access flags you want to use it.
Ex. ADMIN_KICK and ADMIN_SLAP (Cant remember exact names off the top of my head)
do this:
Code:
server_print("The access level is %i",ADMIN_KICK&ADMIN_SLAP)

Use that in the cvar
__________________
Various bits of semi-useful code in a bunch of languages: http://code.devicenull.org/
devicenull is offline
Mugwump
Senior Member
Join Date: May 2004
Old 10-02-2004 , 07:45  
Reply With Quote #3

This works for me, thanks devnull!

-Mug
Mugwump is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 10-03-2004 , 11:53   Re: Question about admin flags stored as cvars
Reply With Quote #4

You could add them to a CVAR, like this:
Code:
register_cvar( "access_level", "mno" ) // 'm' = ADMIN_LEVEL_A // 'n' = ADMIN_LEVEL_B // 'o' = ADMIN_LEVEL_C // etc... //... new szCVAR[32] get_cvar_string( "access_level", szCVAR, 31 ) if ( !(get_user_flags(id) & read_flags(szCVAR) ) {    // No access    return PLUGIN_HANDLED }

xeroblood is offline
Send a message via MSN to xeroblood
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 17:20.


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