Admin Menu Configuration (SourceMod)

From AlliedModders Wiki
Jump to: navigation, search
Language: English  • русский • 中文

SourceMod's administration menu can be configured to change the ordering of items. Items cannot be moved from one category to another, however, they can be re-ordered within categories. Items that are not explicitly sorted are displayed after the sorted items, and they are sorted by their translated phrase in the client's language.

Sorting is controlled via addons/sourcemod/configs/adminmenu_sorting.txt. Each section specifies the name of a category. The order of the sections determines the order the categories are sorted. Each section contains a list of unique item names that specify item sorting.

Note that the items are not commands. They are the unique names associated with each item on the menu. Third party plugins may add new items to the admin menu, and those items will have their own unique names, whether there is an associated command or not.

Sample Layout

This layout is designed to look similar to Mani Admin Plugin's admin menu.

"Menu"
{
    "PlayerCommands"
    {
        "item"      "sm_slay"
        "item"      "sm_kick"
        "item"      "sm_ban"
        "item"      "sm_gag"
        "item"      "sm_burn"
    }

    "ServerCommands"
    {
        "item"      "sm_map"
        "item"      "sm_execcfg"
        "item"      "sm_reloadadmins"
    }

    "VotingCommands"
    {
        "item"      "sm_cancelvote"
        "item"      "sm_votemap"
        "item"      "sm_votekick"
        "item"      "sm_voteban"
    }
}

Alternate Layout

Alternatively instead of using "item" keys SubKeys can be used with the name of the SubKey being what the values of the "item" key would have been. It is important to note that TopMenu configs are not infinitely recursive, so this SubKey layout works at the top level but other keys further within will not be a part of the TopMenus config. Instead the ability to use these SubKeys as items is intended to allow one file to be used as both a TopMenu configuration file (e.g. LoadTopMenuConfig) and a normal KeyValues file (e.g. FileToKeyValues), with all the relevant KeyValue information inside each SubKey.


"Menu"
{
    "PlayerCommands"
    {
        "sm_slay"
        {
            "adminflag"    "f"
        }
    }

    "ServerCommands"
    {
        "sm_map"
        {
            "adminflag"    "g"
        }
    }

    "VotingCommands"
    {
        "sm_cancelvote"
        {
            "adminflag"    "k"
        }
    }
}