-
Notifications
You must be signed in to change notification settings - Fork 9
API
-
* - Optional, can be nil (Change to false if arg doesn't use it for functionality instead for now, otherwise nothing might happen, this is a FiveM bug currently)
-
Item/Menu Names cut off at 25 chars by default, limit adjustable by user.
-
The API Reference only applies for the newest version.
Adds a new menu to the root.
- name - Name of the menu
- *cbdone - Callback once the menu was created
- *cbclicked - Callback once the menu was opened
- id - Unique ID of the created menu or nil on error or if any of the passed non-optional args are nil
- id - Unique ID of the created menu
Adds a new sub-menu to a existing menu.
- parent - Menu to add the sub-menu to
- name - Name of the sub-menu
- *cbdone - Callback once the sub-menu was created
- *cbclicked - Callback once the sub-menu was opened
- id - Unique ID of the created menu or nil on error or if any of the passed non-optional args are nil or parent is invalid
- id - Unique ID of the created menu
Adds a new item to a existing menu.
- *menu- Menu to add the item to (adds to root if nil)
- name - Name of the item
- *onoff - Append ON/OFF switch to the item, either true or false for start state, nil to disable
- *cbdone - Callback once the item was created
- *cbclicked - Callback once the item was selected
- id - Unique ID of the created menu or nil on error or if any of the passed non-optional args are nil or parent is invalid
- id - Unique ID of the created menu
- *datastate - Either
trueif "ON" orfalseif "OFF" if onoff ~= nil, otherwisenil(can be left off ifonoff==nil)
Blocks all input to the trainer.
- state - Block input, either
trueorfalse
Checks if an ID is registered.
- id - The id
- cb - Callback
- result - Either true if registered or false if not
Hides (or rather closes) the menu (if menu is open).
Calls the callback if the menu resource exists, useful for checking.
- cb - Callback
Returns the installed menu resource's version as a string arg in the callback
(newest version is 2.4.2 as of 08/07/18).
- cb - Callback
- version - Version of the installed menu resource
Sets the description of a specific item/menu. Also updates in realtime!
- id - ID of the element
- text - The text (Note: cuts off at 125 chars by default, limit adjustable by user) (v2.4.1 or higher: pass nil to remove description)
Makes an item/menu greyed out. Same as above, updates in realtime.
This won't block any input, it's just visual.
As of v2.3.3, greyed out items block input. cbclicked won't be called on greyed out items either.
Notice the reversed args. That's because making state the last arg turns false into nil for some reason sigh.
- state -
truefor greyed out,falsefor not - id - ID of the element
Returns to callback if item is greyed out.
- id - ID of the element
- cb - The callback
- state -
truefor greyed out,falsefor not
Sets a right text on an item. Does not work with menus or on-off switches! Also again reeeeeeealtime!
Also text length limit is 6 chars by default. It's user-configurable.
- id - ID of the element
- text - The text (
nilto remove text)
Returns to callback the right text of an item to callback
- id - ID of the element
- cb - The callback
- text - Either the text or
nilif there's none
Returns to callback if menu is being shown.
- cb - The callback
- state - Either
trueif menu is visible orfalseif not
Removes an item/menu by ID.
Note that empty menus will be automatically removed and the user gets thrown to the main menu if that happens.
Since v2.4 menus will go back into "empty" state once they contain no items anymore.
- id - ID of the element
Goes back a menu (if menu is open). Genius.
Goes back to main menu (if menu is open).
Sets the state of an ON/OFF switch item.
- id - ID of the ON/OFF switch item
- state - Either
truefor "ON" orfalsefor "OFF"
Gets the state of an ON/OFF switch item.
- id - ID of the ON/OFF switch item
- cb - The callback
- state - Either
trueif "ON",falseif "OFF" ornilif item has no ON/OFF switch.