ActionMenu is a html/js based quick select style menu, it consists of a group of buttons that can each be set to perform a different task, many other communities have this, like DOJ and SOE, but none of them are public.
IF YOUR BUTTONS DO NOT WORK, MAKE SURE YOU HAVE NOT RENAMED THE RESOURCE, OR CHANGE THE RESOURCE NAME ON LINE 117 OF ui.js
This is an example resource, which you must add to in order for it to become usable in your server/gamemode. It is recommended that you only use this if you have experience with Lua and HTML.
Press ‘Z’ (ID: 20) by default to open the menu.
How to add a new button
To add a new button, use the following template, and place the button inside the mainmenu div, or a sub-menu div in the ui.html file:
<button class="menuoption" data-action="buttonaction">Button Name</button>
The Button Name is what the text that will display on the button, and the data-action is what the NUI Callback receives when you click the button. You must make sure that all buttons you add have the menuoption class, otherwise they will not work. So say I wanted to add a hands up button, I would put:
<button class="menuoption" data-action="handsup">Put Hands Up</button>
How to add a new sub-menu
To add a new sub-menu, use the following template, and place the div inside of the actionmenu div in of the ui.html file:
<div id="submenuname" data-parent="mainmenu" style="display: none;"> <!-- buttons --> </div>
If you look inside of the ui.html file, you will see how I’ve set up the sub-menus. In order for a sub-menu to be opened, you must set up a button with a data-sub attribute, that is equal to the ID of the sub-menu div.
- Download the latest version above
- Extract the wk_actionmenu folder from the .zip file into your resources folder
- Add ‘start wk_actionmenu’ into your server.cfg
Version 1.0.1 - Fixed buttons overflowing off the screen - Localised the font file - Gave the buttons a graphical update - Pressing ESC when the menu is open now closes it - Added a " >>" indicator to help identify submenus - Back and Exit buttons now get automatically generated for every submenu Version 1.0.0 - Initial release
You are free to do whatever you want with this resource, but you are not allowed to re-upload it without my permission. You agree to this by downloading the resource.
Me - writing the script and making it do cool shit.
@lowheartrate - I used some of his work as a base
@Briglair - Helping with a few issues on @lowheartrate’s post