Raised This Month: $ Target: $400
 0% 

Admin flags do not work


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 08-24-2011 , 08:42   Re: Admin flags do not work
Reply With Quote #3

Overriding Command Access
Quote:
Introduction

Command access overrides are one of the most powerful aspects of the SourceMod administration system. They effectively let you:
  • Change the access to any command without modifying plugin source code;
  • Change the access to entire groups of commands without modifying source code;
  • Create custom access levels;
  • Allow or deny commands and groups of commands to an administrator group regardless of the command flags.
When you change the permissions to a SourceMod object, it is called an override. An override is an arbitrary string. If the override string matches a command name, then the command permissions will be inherited from that override.
This concept is important for two reasons:
  • An override can change the permissions of a command.
  • An override can be used as a custom access flag.
For example, a plugin might require access "g" to use the sm_map command. However, an override could explicitly allow/deny usage of this command to a given group, and/or it could change the default flag for sm_map to be "k" instead.
More interestingly, a plugin could require sm_map access in order to use a specific menu option. In this case, a user would have to be able to access sm_map, rather than have a hardcoded flag.
As a final example of the flexibility of this system, a plugin might say that users must be able to access plugin_crab_usage, which isn't a command at all. Instead, the plugin assumes a default access level internally, and users can opt to override it as they wish. This demonstrates that overrides are separate from commands, however, commands themselves inherit their permissions from overrides of the same name.
heh, try this
admin_overrides.cfg
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.
     */
    "myrandomoverridetext"        "n" // added flag cheat
    "menu_password"        "l" // added flag password
}
ok I show example of adminmenu_custom.txt because you didn't show whole file.
Code:
// Custom admin menu commands.
// For more information:
//
// http://wiki.alliedmods.net/Custom_Admin_Menu_%28SourceMod%29
//
// Note: This file must be in Valve KeyValues format (no multiline comments)
//

"Commands"
{
    "ServerCommands"
    {
        "Enable Cheats"
        {
            "cmd"            "sv_cheats #1"
            "admin"            "myrandomoverridetext"
            "execute"        "server"
            "1"
            {
                "type"        "onoff"
            }
        }
        "Server password"
        {
            "cmd"            "sv_password @1"
            "admin"            "menu_password"
            "execute"        "server"
            "1"
            {
                "title"        "Select a password"
                "1"            "knockers"
                "2"            "chair"
                "3"            "vesper"
                "4"            "none"
                "4."        "Reset"
            }
        }
    }
}
If you all get it, there not exist command "myrandomoverridetext" (very lucky if have). You can make/add in override list any word and give to flag.

Like now, anybody who have of course, access to admin menu, flag "b" (generic) or from admin_groups.cfg "sm_admin" "allow" to bring admin menu.
Then second, access to this "myrandomoverridetext"
from admin flag "n" (cheat) or from admin_groups.cfg "myrandomoverridetext" "allow" to see those "Enable Cheats" under "ServerCommands"

Hope you understand who read


*edit
I added different override in menu "Server Password" = "menu_password"
__________________
Do not Private Message @me

Last edited by Bacardi; 08-24-2011 at 08:56.
Bacardi is online now
 



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 12:20.


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