Method Maps2
SymbolDescription
MenuA menu is a helper object for managing in-game menus.
PanelPanels are used for drawing raw menus without any extra helper functions. Handles must be closed via delete or CloseHandle().
Enumerations3
SymbolDescription
MenuActionDifferent actions for the menu "pump" callback
MenuSourceDescribes a menu's source
MenuStyleLow-level drawing style of the menu.
Type Sets2
SymbolDescription
MenuHandlerCalled when a menu action is completed.
VoteHandlerCallback for when a vote has ended and results are available.
Constants14
SymbolDescription
MenuCancel_DisconnectedClient dropped from the server
MenuCancel_ExitClient exited via "exit"
MenuCancel_ExitBackClient selected "exit back" on a paginated menu
MenuCancel_InterruptedClient was interrupted with another menu
MenuCancel_NoDisplayMenu could not be displayed to the client
MenuCancel_TimeoutMenu timed out
MenuEnd_CancelledMenu was cancelled (reason in param2)
MenuEnd_ExitMenu was cleanly exited via "exit"
MenuEnd_ExitBackMenu was cleanly exited via "back"
MenuEnd_SelectedMenu item was selected
MenuEnd_VotingCancelledVoting was cancelled
MenuEnd_VotingDoneVoting finished
VoteCancel_GenericVote was generically cancelled.
VoteCancel_NoVotesVote did not receive any votes.
Defines20
SymbolDescription
ITEMDRAW_CONTROLItem is control text (back/next/exit)
ITEMDRAW_DEFAULTItem should be drawn normally
ITEMDRAW_DISABLEDItem is drawn but not selectable
ITEMDRAW_IGNOREItem should be completely ignored (rawline + notext)
ITEMDRAW_NOTEXTNo text should be drawn
ITEMDRAW_RAWLINEItem should be a raw line, without a slot
ITEMDRAW_SPACERItem should be drawn as a spacer, if possible
MENU_ACTIONS_ALL
MENU_ACTIONS_DEFAULT
MENU_NO_PAGINATIONMenu should not be paginated (10 items max)
MENU_TIME_FOREVERMenu should be displayed as long as possible
MENUFLAG_BUTTON_EXITMenu has an "exit" button (default if paginated)
MENUFLAG_BUTTON_EXITBACKMenu has an "exit back" button
MENUFLAG_BUTTON_NOVOTEMenu has a "No Vote" button at slot 1
MENUFLAG_NO_SOUNDMenu will not have any select sounds
VOTEFLAG_NO_REVOTESPlayers cannot change their votes
VOTEINFO_CLIENT_INDEXClient index
VOTEINFO_CLIENT_ITEMItem the client selected, or -1 for none
VOTEINFO_ITEM_INDEXItem index
VOTEINFO_ITEM_VOTESNumber of votes for the item
Functions54
SymbolDescription
AddMenuItemAppends a new item to the end of a menu.
CancelClientMenuCancels a menu on a client. This will only affect non-external menus.
CancelMenuCancels a menu from displaying on all clients. While the cancellation is in progress, this menu cannot be re-displayed to any clients. The menu may still exist on the client's screen after this command. This simply verifies that the menu is not being used anywhere. If any vote is in progress on a menu, it will be cancelled.
CancelVoteCancels the vote in progress.
CanPanelDrawFlagsReturns whether or not the given drawing flags are supported by the menu style.
CheckVoteDelayReturns 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).
CreateMenuCreates a new, empty menu using the default style.
CreateMenuExCreates a Menu from a MenuStyle. The Handle must be closed with CloseHandle().
CreatePanelCreates a MenuPanel from a MenuStyle. Panels are used for drawing raw menus without any extra helper functions. The Handle must be closed with CloseHandle().
CreatePanelFromMenuCreates a raw MenuPanel based off the menu's style. The Handle must be freed with CloseHandle().
DisplayMenuDisplays a menu to a client.
DisplayMenuAtItemDisplays a menu to a client, starting from the given item.
DrawPanelItemDraws an item on a panel. If the item takes up a slot, the position is returned.
DrawPanelTextDraws a raw line of text on a panel, without any markup other than a newline.
GetClientMenuReturns whether a client is viewing a menu.
GetMaxPageItemsReturns a style's maximum items per page.
GetMenuExitBackButtonReturns whether or not the menu has an "exit back" button. By default, menus do not have an exit back button. Exit Back buttons appear as "Back" on page 1 of paginated menus and have functionality defined by the user in MenuEnd_ExitBack.
GetMenuExitButtonReturns whether or not the menu has an exit button. By default, menus have an exit button.
GetMenuItemRetrieves information about a menu item.
GetMenuItemCountReturns the number of items in a menu.
GetMenuOptionFlagsRetrieves a menu's option flags.
GetMenuPaginationReturns a menu's pagination setting.
GetMenuSelectionPositionReturns the first item on the page of a currently selected menu. This is only valid inside a MenuAction_Select callback.
GetMenuStyleReturns a menu's MenuStyle Handle. The Handle is global and cannot be freed.
GetMenuStyleHandleReturns a style's global Handle.
GetMenuTitleReturns the text of a menu's title.
GetMenuVoteInfoRetrieves voting information from MenuAction_VoteEnd.
GetPanelCurrentKeyReturns the current key position.
GetPanelStyleReturns a MenuPanel's parent style.
GetPanelTextRemainingReturns the amount of text the menu can still hold. If this is limit is reached or overflowed, the text is silently truncated. Radio menus: Currently 511 characters (512 bytes). Valve menus: Currently -1 (no meaning).
InsertMenuItemInserts an item into the menu before a certain position; the new item will be at the given position and all next items pushed forward.
InternalShowMenuThis 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. This function is only usable with the Radio Menu style. You do not need to split up your menu into multiple packets; SourceMod will break the string up internally.
IsClientInVotePoolReturns 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().
IsNewVoteAllowedQuick 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.
IsVoteInProgressReturns whether a vote is in progress.
MenuSetClientMappingFills the client vote option mapping with user supplied values.
MenuShufflePerClientGenerates a per-client random mapping for the current vote options.
RedrawClientVoteMenuRedraws the current vote menu to a client in the voting pool.
RedrawMenuItemRedraws menu text from inside a MenuAction_DisplayItem callback.
RemoveAllMenuItemsRemoves all items from a menu.
RemoveMenuItemRemoves an item from the menu.
SendPanelToClientSends 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. MenuAction_Select (param2 will be the key pressed) MenuAction_Cancel (param2 will be the reason) Also, if the menu fails to display, no callbacks will be called.
SetMenuExitBackButtonSets whether or not the menu has an "exit back" button. By default, menus do not have an exit back button. Exit Back buttons appear as "Back" on page 1 of paginated menus and have functionality defined by the user in MenuEnd_ExitBack.
SetMenuExitButtonSets whether or not the menu has an exit button. By default, paginated menus have an exit button. If a menu's pagination is changed to MENU_NO_PAGINATION, and the pagination was previously a different value, then the Exit button status is changed to false. It must be explicitly re-enabled afterwards. If a non-paginated menu has an exit button, then at most 9 items will be displayed.
SetMenuNoVoteButtonSets whether or not the menu has a "no vote" button in slot 1. By default, menus do not have a no vote button.
SetMenuOptionFlagsSets a menu's option flags. If a certain bit is not supported, it will be stripped before being set. See SetMenuExitButton() for information on Exit buttons. See SetMenuExitBackButton() for information on Exit Back buttons.
SetMenuPaginationSets whether the menu should be paginated or not. If itemsPerPage is MENU_NO_PAGINATION, and the exit button flag is set, then the exit button flag is removed. It can be re-applied if desired.
SetMenuTitleSets the menu's default title/instruction message.
SetPanelCurrentKeySets the next key position. This cannot be used to traverse backwards.
SetPanelKeysSets the selectable key map of a panel. This is not supported by all styles (only by Radio, as of this writing).
SetPanelTitleSets the panel's title.
SetVoteResultCallbackSets an advanced vote handling callback. If this callback is set, MenuAction_VoteEnd will not be called.
VoteMenuBroadcasts 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. Note that MenuAction_VoteEnd and MenuAction_VoteStart are both default callbacks and do not need to be enabled.
VoteMenuToAllSends a vote menu to all clients. See VoteMenu() for more information.