Raised This Month: $32 Target: $400
 8% 

Problem with flags (RegAdminCmd)


Post New Thread Reply   
 
Thread Tools Display Modes
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 03-03-2018 , 23:42   Re: Problem with flags (RegAdminCmd)
Reply With Quote #11

Quote:
Originally Posted by eyal282 View Post
Then what's the workaround?
It was posted in post 5. You'd need several individual CheckCommandAccess calls.

Alternatively, some manual checking against GetAdminFlags would work. I think that this may be one of the few cases where GetAdminFlags/GetUserFlagBits would be preferred over CheckCommandAccess.

You could probably also use admin groups and group overrides to accomplish this more elegantly, but I've used that system only in brief testing of other plugins, so I'm not positive.


Quote:
Originally Posted by eyal282 View Post
Before you keep this, try

(ADMFLAG_CUSTOM1&ADMFLAG_CUSTOM5)|ADMFLAG_CHA NGEMAP
Code:
(ADMFLAG_CUSTOM1&ADMFLAG_CUSTOM5)|ADMFLAG_CHANGEMAP
Think about what this is doing.

First, we combine CUSTOM1 and CUSTOM5 with the & operator. What do CUSTOM1 and CUSTOM5 have in common? Nothing. So that evaluates to zero.
Code:
(0)|ADMFLAG_CHANGEMAP
Then, it combines 0 and CHANGEMAP with the | operator. Any "on" bits in either operand are "on" in the result. Since 0 has no on bits, it does nothing.
Code:
ADMFLAG_CHANGEMAP
__________________

Last edited by ddhoward; 03-04-2018 at 01:28.
ddhoward is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 03-04-2018 , 09:55   Re: Problem with flags (RegAdminCmd)
Reply With Quote #12

If you want to get technical you can merge two of the GetCommandAccess calls together, like this:

PHP Code:
if (CheckCommandAccess(client"sm_asd"ADMFLAG_CUSTOM1|ADMFLAG_CUSTOM5)
    || 
CheckCommandAccess(client"sm_asd"ADMFLAG_CHANGEMAP)) 
These two still need to remain separate as they're two separate checks.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 03-04-2018 at 09:59. Reason: Added missing )
Powerlord is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-05-2018 , 16:23   Re: Problem with flags (RegAdminCmd)
Reply With Quote #13

Setting admin group with overrides you can restrict command "words" instead. Not need play with letters
__________________
Do not Private Message @me
Bacardi 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 00:26.


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