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

Multiple Admin Flags


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 11-06-2011 , 15:39   Multiple Admin Flags
Reply With Quote #1

I have a quick question. When specifying multiple admin flags in RegAdminCmd, do only admins who have all of the flags have access, or only one or more of the flags.

For instance, in

Code:
RegAdminCmd("sm_votemap", Command_Votemap, ADMFLAG_VOTE|ADMFLAG_CHANGEMAP, "sm_votemap <mapname> [mapname2] ... [mapname5] ");
Do only admins with ADMFLAG_VOTE && ADMFLAG_CHANGEMAP have access, or can ADMFLAG_VOTE admins without ADMFLAG_CHANGEMAP initiate it?

Thanks!
__________________
Dr. McKay is offline
McFlurry
Veteran Member
Join Date: Mar 2010
Location: RemoveEdict(0);
Old 11-06-2011 , 16:15   Re: Multiple Admin Flags
Reply With Quote #2

ADMFLAG_* are all bit values so I would guess it would have to be that the person using the command would have to have both flags. You could easily test it yourself by changing your admin flags.
__________________
McFlurry is offline
Send a message via Skype™ to McFlurry
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 11-06-2011 , 23:59   Re: Multiple Admin Flags
Reply With Quote #3

You can do same thing without editing plugin and
use SM ...addons\sourcemod\configs\admin_overrides.c fg
Code:
Overrides
{
    /**
     * By default, commands are registered with three pieces of information:
     * 1)Command Name         (for example, "csdm_enable")
     * 2)Command Group Name    (for example, "CSDM")
     * 3)Command Level        (for example, "changemap")
     *
     * You can override the default flags assigned to individual commands or command groups in this way.
     * To override a group, use the "@" character before the name.  Example:
     * Examples:
     *        "@CSDM"            "b"                // Override the CSDM group to 'b' flag
     *         "csdm_enable"    "bgi"            // Override the csdm_enable command to 'bgi' flags
     *
     * Note that for overrides, order is important.  In the above example, csdm_enable overwrites
     * any setting that csdm_enable previously had.
     *
     * You can make a command completely public by using an empty flag string.
     */

     "sm_votemap"    "gk"
}
*edit
to clarify, what McFlurry already mention. Admin who have both flags (g and k) can use this command.

and with admin_groups.cfg you can give commands (or deny) instead give admin flags... trollolollooo
__________________
Do not Private Message @me

Last edited by Bacardi; 11-07-2011 at 00:05.
Bacardi is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 11-07-2011 , 00:04   Re: Multiple Admin Flags
Reply With Quote #4

ya, just set the flag you want, then the server admins can always override it

and if it's not an admin command, use checkcommandaccess
TnTSCS is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 11-07-2011 , 01:08   Re: Multiple Admin Flags
Reply With Quote #5

Thanks for the answers! I only ask because I'm editing base plugins (mainly funcommands and funvotes, to make the sm_burn command use TF2-style igniting), and I noticed that sm_votemap had ADMFLAG_VOTE|ADMFLAG_CHANGEMAP, and I hadn't looked before to see if you needed both the vote flag and the changemap flag.
__________________

Last edited by Dr. McKay; 11-07-2011 at 01:09.
Dr. McKay is offline
Whai
Senior Member
Join Date: Jul 2018
Old 10-21-2018 , 18:28   Re: Multiple Admin Flags
Reply With Quote #6


I have a question :

Is there a difference between
Code:
ADMFLAG_VOTE|ADMFLAG_CHANGEMAP
and this ?
Code:
ADMFLAG_VOTE||ADMFLAG_CHANGEMAP

Last edited by Whai; 10-21-2018 at 18:30.
Whai is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-21-2018 , 18:44   Re: Multiple Admin Flags
Reply With Quote #7

Quote:
Originally Posted by Whai View Post

I have a question :

Is there a difference between
Code:
ADMFLAG_VOTE|ADMFLAG_CHANGEMAP
and this ?
Code:
ADMFLAG_VOTE||ADMFLAG_CHANGEMAP
The first works and the second doesn't.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 10-21-2018 at 18:53.
Powerlord is offline
Whai
Senior Member
Join Date: Jul 2018
Old 10-21-2018 , 18:48   Re: Multiple Admin Flags
Reply With Quote #8

Quote:
Originally Posted by Powerlord View Post
The first works and the second doesn't.
Ok, thanks for this awnser
__________________
Whai is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 10-21-2018 , 18:53   Re: Multiple Admin Flags
Reply With Quote #9

Quote:
Originally Posted by Whai View Post
Ok, thanks for this awnser
If you want an actual explanation, which is kinda boring:
  • | is used to combine bits together
  • || is used as logical or

ADMFLAG_VOTE|ADMFLAG_CHANGEMAP has a binary value of 10001000000 (decimal 1088) which stands for bits 10 (ADMFLAG_CHANGEMAP) and 6 (ADMFLAG_VOTE) using 0-based numbering (right to left starting with bit 0 on the far right) being set
ADMFLAG_VOTE||ADMFLAG_CHANGEMAP has a value of 1 which stands for true.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 10-21-2018 at 18:56.
Powerlord is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 10-22-2018 , 04:07   Re: Multiple Admin Flags
Reply With Quote #10

Doesn't Admflag_x & admflag_y work? Or +? Try adding both flags.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 10-22-2018 at 04:10.
eyal282 is offline
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 06:50.


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