Classes 2

Class Description
Menu

A menu is a helper object for managing in-game menus.

Panel

Panels are used for drawing raw menus without any extra helper functions. Handles must be closed via delete or CloseHandle().

Enums 3

Enum Description
MenuAction

Different actions for the menu "pump" callback

MenuSource

Describes a menu's source

MenuStyle

Low-level drawing style of the menu.

Types 2

Type Description
MenuHandler

Called when a menu action is completed.

VoteHandler

Callback for when a vote has ended and results are available.

Functions 54

Function Description
AddMenuItem

Appends a new item to the end of a menu.

CancelClientMenu

Cancels a menu on a client. This will only affect non-external menus.

CancelMenu

Cancels a menu from displaying on all clients. While the cancellation is in progress, this menu cannot be re-displayed to any clients.

CancelVote

Cancels the vote in progress.

CanPanelDrawFlags

Returns whether or not the given drawing flags are supported by the menu style.

CheckVoteDelay

Returns the number of seconds you should "wait" before displaying a publicly invocable menu. This number is the time remaining until (last_vote + sm_vote_delay).

CreateMenu

Creates a new, empty menu using the default style.

CreateMenuEx

Creates a Menu from a MenuStyle. The Handle must be closed with CloseHandle().

CreatePanel

Creates a MenuPanel from a MenuStyle. Panels are used for drawing raw menus without any extra helper functions. The Handle must be closed with CloseHandle().

CreatePanelFromMenu

Creates a raw MenuPanel based off the menu's style. The Handle must be freed with CloseHandle().

DisplayMenu

Displays a menu to a client.

DisplayMenuAtItem

Displays a menu to a client, starting from the given item.

DrawPanelItem

Draws an item on a panel. If the item takes up a slot, the position is returned.

DrawPanelText

Draws a raw line of text on a panel, without any markup other than a newline.

GetClientMenu

Returns whether a client is viewing a menu.

GetMaxPageItems

Returns a style's maximum items per page.

GetMenuExitBackButton

Returns whether or not the menu has an "exit back" button. By default, menus do not have an exit back button.

GetMenuExitButton

Returns whether or not the menu has an exit button. By default, menus have an exit button.

GetMenuItem

Retrieves information about a menu item.

GetMenuItemCount

Returns the number of items in a menu.

GetMenuOptionFlags

Retrieves a menu's option flags.

GetMenuPagination

Returns a menu's pagination setting.

GetMenuSelectionPosition

Returns the first item on the page of a currently selected menu.

GetMenuStyle

Returns a menu's MenuStyle Handle. The Handle is global and cannot be freed.

GetMenuStyleHandle

Returns a style's global Handle.

GetMenuTitle

Returns the text of a menu's title.

GetMenuVoteInfo

Retrieves voting information from MenuAction_VoteEnd.

GetPanelCurrentKey

Returns the current key position.

GetPanelStyle

Returns a MenuPanel's parent style.

GetPanelTextRemaining

Returns the amount of text the menu can still hold. If this is limit is reached or overflowed, the text is silently truncated.

InsertMenuItem

Inserts an item into the menu before a certain position; the new item will be at the given position and all next items pushed forward.

InternalShowMenu

This function is provided for legacy code only. Some older plugins may use network messages instead of the panel API. This function wraps the panel API for eased portability into the SourceMod menu system.

IsClientInVotePool

Returns whether a client is in the pool of clients allowed to participate in the current vote. This is determined by the client list passed to VoteMenu().

IsNewVoteAllowed

Quick stock to determine whether voting is allowed. This doesn't let you fine-tune a reason for not voting, so it's not recommended for lazily telling clients that voting isn't allowed.

IsVoteInProgress

Returns whether a vote is in progress.

MenuSetClientMapping

Fills the client vote option mapping with user supplied values.

MenuShufflePerClient

Generates a per-client random mapping for the current vote options.

RedrawClientVoteMenu

Redraws the current vote menu to a client in the voting pool.

RedrawMenuItem

Redraws menu text from inside a MenuAction_DisplayItem callback.

RemoveAllMenuItems

Removes all items from a menu.

RemoveMenuItem

Removes an item from the menu.

SendPanelToClient

Sends a panel to a client. Unlike full menus, the handler function will only receive the following actions, both of which will have INVALID_HANDLE for a menu, and the client as param1.

SetMenuExitBackButton

Sets whether or not the menu has an "exit back" button. By default, menus do not have an exit back button.

SetMenuExitButton

Sets whether or not the menu has an exit button. By default, paginated menus have an exit button.

SetMenuNoVoteButton

Sets whether or not the menu has a "no vote" button in slot 1. By default, menus do not have a no vote button.

SetMenuOptionFlags

Sets a menu's option flags.

SetMenuPagination

Sets whether the menu should be paginated or not.

SetMenuTitle

Sets the menu's default title/instruction message.

SetPanelCurrentKey

Sets the next key position. This cannot be used to traverse backwards.

SetPanelKeys

Sets the selectable key map of a panel. This is not supported by all styles (only by Radio, as of this writing).

SetPanelTitle

Sets the panel's title.

SetVoteResultCallback

Sets an advanced vote handling callback. If this callback is set, MenuAction_VoteEnd will not be called.

VoteMenu

Broadcasts a menu to a list of clients. The most selected item will be returned through MenuAction_End. On a tie, a random item will be returned from a list of the tied items.

VoteMenuToAll

Sends a vote menu to all clients. See VoteMenu() for more information.