Custom Admin Menu (SourceMod)

From AlliedModders Wiki
Revision as of 17:15, 6 December 2007 by PRED* (talk | contribs) (Example Files)
Jump to: navigation, search

NB: This is currently implemented as a third party plugin ‘SM Super Menu’ and will become available as part of core package with version 1.1

Introduction

Use as a complement to plugins adding themselves to the menu *link* What it does.

Parameter List

  • cmd - command to be executed (#1,#2 etc for parameters - no limit on these) Use @num to have the parameter sent without being surrounded by "quotes"
  • admin - admin level required to access the command - see Admin Levels
  • execute - 'server' or 'player' - selects whether to execute as a client command or server command
  • 1 - Information about parameter 1 (#1) - You need as many of these as you have parameters
    • type - defaults to 'list' if not provided
      • 'groupplayer' - List of Groups + connected player
      • 'group' - List of Groups
      • 'player' - List of players
      • 'list' - Custom Defined list of Options
      • 'mapcycle' - Auto filled with the contents of your mapcycle file
      • 'onoff' - On or Off menu that sends the numbers 1/0 (good for cvars etc)
    • path - Only required for type mapcycle. Path (including file name and extension) to the file containing a list of maps (straight text formatting like mapcycle.txt)
    • method - 'name', 'steamid', 'userid', 'clientid' - only needed for groupplayer/player menus - defaults to name
    • title - To be shown for the parameter selection menu (optional)
    • 1-x - List parameters - only needed for 'list' type parameters
    • 1.-x. - Text to be shown for parameter - only needed for 'list' type parameters (optional, above will be used as text if ommited)
    • 1* - x* - Admin level required to see this option (same as the rest of the admin types)

Example Command

"Commands"
{
	"Fun Commands"
	{
		"Set Player Speed"
		{
			"cmd"			"sm_speed #1 @2"
			"admin"			"sm_kick"
			"execute"		"player"
			"1"
			{
				"type" 		"teamplayer"
				"method"	"name"
				"title"		"Player/Team to Edit"
 
			}
			"2"
			{
				"type" 		"list"
				"title"		"Speed Multiplier"
				"1"		"1.0"
				"1."		"Normal"
				"2"		"0.8"
				"2."		"80%"
				"3"		"0.5"
				"3."		"Half"
				"4"		"1.5"
				"4."		"50% Boost"
				"5"		"2.0"
				"5."		"Double"
				"5*"		"sm_ban" 
				//restrict the double option to admins who have access to the 'sm_ban' override
			}
 
		}
	}
}

Using the above as the contents of your menu.ini config file would create a new category option in the admin menu called 'Fun Commands'.

  • This category would contain an option called : "Set Player Speed".
  • Selecting it would prompt another menu titled: "Player/Team to Edit" containing a list of Groups and Player Names.
  • Selecting one of these would prompt a second menu titled "Speed Multiplier".
  • List of options like "Normal", "80%" etc.
  • Example command sent if the user selected "Double" (through the player using fakeclientcommand) - "sm_speed @CT 2.0"

Admin Levels

All 'admin' types now require a string command name. This command can be already existing (sm_ban) or completely imaginary (reallyweirdcommandnamethatdoesntexist).

If the command exists that section (or list option) will require the exact same access level as that command (including any overrides you have specified). Eg you use sm_ban as the admin level for a submenu. Admins will require the 'ban' flag to access this. However if you have overridden sm_ban in one of your lower groups ("override" "allow" - in admin_groups.cfg). This group will also have access.

If the command doesn't exist you will need to add it to your overrides sections as if it was a normal command. This can be done in admin_overrides.cfg (to assign flag letters to this command), and/or in admin_groups.cfg (to give access to the command to a specified group or remove it from a group even though they have the flag)

For more information, see Overriding Command Access

Group Submenus

Types 'group' and 'groupplayer' auto-add pre configured options to the menu. These options are configured using sourcemod/configs/adminmenu_grouping.txt

They are generally used to provide common commands like '@all' , '@t' etc to your menus.

Categories

If you wish to add items to an existing category you will need to specify it’s internal name. For the three categories provided by SourceMod base these are:

  • PlayerCommands
  • ServerCommands
  • VotingCommands

Extra Uses

An example of using the dynamic menu to it's full potential: Giving admins access to some cvars while not letting them have general 'sm_cvar' access.

Add the cvar you want to make available using the command directly and set the 'execute' parameter.

"cmd"		"mp_friendlyfire #1"
"execute"	"server"
"admin"		"sm_kick"

This fires the command directly through rcon so there are no admin pre-requisites (other than what you set using the 'admin' parameter). This method can be used to create a list of commonly used (and low impact) cvars that your lower admins can change at will, without giving them access to everything. The same method works for rcon commands.

Example Files

How do you attach files?