On it's own this plugin does nothing, it requires other plugins to utilize the features provided.
Details:
Creates more than 1-7 selectable entries compared to default menus.
Various menu types:
- Selectable option only
- Toggle option on/off
- Select through a list of options
- Increment and decrement by a value, with default, minimum and maximum values
Supports translations (the whole menu needs to be added to the translations to function).
Supports adding multiple pages to select through, specify where a new page starts.
Sreaper - For various feature suggestions and testing.
Psykotik - For reviewing the code and coding suggestions.
Cvars:
Saved to extra_menu_api.cfg in your servers \cfg\sourcemod\ folder.
PHP Code:
// Path to the sound to play when moving through the menu. Or "" for no sound.
extra_menu_sound_move "buttons/button14.wav"
// Path to the sound to play when clicking a menu option. Or "" for no sound.
extra_menu_sound_click "buttons/combine_button7.wav"
Example Plugins:
Extra Menu API - Test Plugin
Shows all the different selectable menu types
Shows adding an extra page of menu options
Shows usage for other plugins, to add and delete the menu
Creates the command sm_menutest to open the menu
Extra Menu API - Test Translations
Shows a basic menu using translations.
Shows opening another menu when selecting an entry
Shows usage for other plugins, to add and delete the menu
Creates the command sm_menutrans to open the menu
Natives and Forwards for developers: (see the extra_menu.inc include file for details)
Spoiler
PHP Code:
// Different row types allowed in the menu
enum EXTRA_MENU_TYPE
{
MENU_ENTRY, // Simple row of text, not selectable
MENU_SELECT_ONLY, // Entry that can be selected
MENU_SELECT_ONOFF, // Entry that will turn on/off when selected
MENU_SELECT_LIST, // Scroll through a list of entries
MENU_SELECT_ADD, // Entry that will increment and decrement a value
}
// Creates a new menu
native int ExtraMenu_Create(bool back = false, char[] translation = "", bool buttons_nums = false);
// Deletes the specified menu
native bool ExtraMenu_Delete(int menu_id);
// Adds a row entry to the menu, either non-selectable text or an option to select.
native bool ExtraMenu_AddEntry(int menu_id, char[] entry, EXTRA_MENU_TYPE type, bool close = false, int default_value = 0, any add_value = 0, any add_min = -999999, any add_max = 999999);
// Adds a set of options to scroll through, for use with the "MENU_SELECT_LIST" type.
native bool ExtraMenu_AddOptions(int menu_id, char[] entry);
// Adds the next "ExtraMenu_AddEntry" data to a new page and creates the "Next Page" and "Previous Page" options
native void ExtraMenu_NewPage(int menu_id);
// Displays a menu to a client.
native bool ExtraMenu_Display(int client, int menu_id, int time = MENU_TIME_FOREVER);
// Triggers whenever any menu item is selected, verify the ID with your known menus.
forward void ExtraMenu_OnSelect(int client, int menu_id, int option, int value);
Changes:
Code:
1.4 (15-Oct-2022)
- New feature: Native "ExtraMenu_Create" can now create menus that use 1/2/3/4 to move and select instead of freezing the player and using W/A/S/D keys.
- Added new "translations/extra_menu.phrases.txt" translation file to support the new menu type.
- Changed to store the menu data in StringMaps, for lower memory and an unlimited number of menus.
- This is still ultra fast to store and retrieve the menu data.
1.3 (27-Aug-2022)
- Fixed not deleting some handles when deleting a menu.
1.2 (15-Aug-2022)
- Fixed errors thrown when displaying a menu and the clients index is 0.
- Increased the maximum length of rows to support multi-byte characters.
- Added a "meter" option demonstration to the "extra_menu_test" plugin.
1.1 (04-Aug-2022)
- Fixed the button sounds not playing.
- Fixed the menu not ending when interrupted by another menu.
1.0 (30-Jul-2022)
- Initial release.
Installation:
Download the .zip and extract the files to their respective folders in your servers \addons\sourcemod\ folder.
Only the \sourcemod\plugins\extra_menu.smx is required to use the plugin, all other files are for developers to use.
1.2 (15-Aug-2022)
- Fixed errors thrown when displaying a menu and the clients index is 0.
- Increased the maximum length of rows to support multi-byte characters.
- Added a "meter" option demonstration to the "extra_menu_test" plugin.
1.4 (15-Oct-2022)
- New feature: Native "ExtraMenu_Create" can now create menus that use 1/2/3/4 to move and select instead of freezing the player and using W/A/S/D keys.
- Added new "translations/extra_menu.phrases.txt" translation file to support the new menu type.
- Changed to store the menu data in StringMaps, for lower memory and an unlimited number of menus.
- This is still ultra fast to store and retrieve the menu data.