Skip to content

Menu

Functions

Return Type Name Description
menu_skeleton menu.root() Root of your scripts dedicated submenu
menu_skeleton menu.player_root() Root of your scripts dedicated submenu inside of Network > Players

Types

Return Type Name Description
nil resize(number size, function callback(menu_skeleton)) Safely resize the submenu
nil on_enter(function callback(menu_skeleton)) Called when the submenu is entered
nil on_leave(function callback(menu_skeleton)) Called when the submenu is left
menu_skeleton submenu(string name, string? tooltip) Creates a new submenu
menu_button button(string name) Creates a new button
menu_breaker breaker(string name) Creates a new breaker
menu_color color(string name) Creates a new color
menu_toggle toggle(string name) Creates a new toggle
menu_label label(string name) Creates a new label
menu_textbox textbox(string name) Creates a new textbox
menu_number number(string name, NumberType type, OptScroll? action) Creates a new number
menu_combo combo(string name, ComboType type, table<table<string, X>[]> list, OptScroll? action, bool? multi) Creates a new combo
Property Name
menu_class_id[] options
Return Type Name Description
menu_base as_base() Returns the option as this type
menu_button as_button() Returns the option as this type
menu_breaker as_breaker() Returns the option as this type
menu_color as_color() Returns the option as this type
menu_toggle as_toggle() Returns the option as this type
menu_label as_label() Returns the option as this type
menu_textbox as_textbox() Returns the option as this type
menu_number as_number(NumberType type) Returns the option as this type
menu_combo as_combo(ComboType type) Returns the option as this type
menu_skeleton as_skeleton() Returns the option as this type
Property Name
OptClassId id
Property Name
string name
OptType type
OptSubType sub_type
Return Type Name Description
menu_button has_flags(OptFlag flags) Sets flags
menu_button tooltip(string tooltip) Sets the tooltip
menu_button on_click(function callback(menu_button)) Called when the option is pressed
menu_button on_enter(function callback(menu_button)) Called when the option is entered
menu_button on_leave(function callback(menu_button)) Called when the option is left
Property Name
string name
OptType type
OptSubType sub_type
Return Type Name Description
menu_color has_flags(OptFlag flags) Sets flags
menu_color tooltip(string tooltip) Sets the tooltip
menu_color on_click(function callback(menu_color)) Called when the option is pressed
menu_color no_alpha() Disables ability to modify the alpha channel
Property Name
string name
OptType type
OptSubType sub_type
color value
Return Type Name Description
menu_toggle has_flags(OptFlag flags) Sets flags
menu_toggle tooltip(string tooltip) Sets the tooltip
menu_toggle on_click(function callback(menu_toggle)) Called when the option is pressed
menu_toggle on_enter(function callback(menu_toggle)) Called when the option is entered
menu_toggle on_leave(function callback(menu_toggle)) Called when the option is left
Operator Description
[player] Returns an instance to toggle_player_lua_state
Property Name
string name
OptType type
OptSubType sub_type
bool value

toggle_player_lua_state

Property Name
bool value
Return Type Name Description
menu_label has_flags(OptFlag flags) Sets flags
menu_label tooltip(string tooltip) Sets the tooltip
menu_label on_click(function callback(menu_label)) Called when the option is pressed
menu_label disable_colon() Disable the colon
Property Name
string name
OptType type
OptSubType sub_type
string value
Return Type Name Description
menu_textbox has_flags(OptFlag flags) Sets flags
menu_textbox tooltip(string tooltip) Sets the tooltip
menu_textbox on_submit(function callback(menu_textbox), string text) Called when the text is submitted
menu_textbox on_enter(function callback(menu_textbox)) Called when the option is entered
menu_textbox on_leave(function callback(menu_textbox)) Called when the option is left
menu_textbox default_value(string text) Default value
menu_textbox max_chars(number max) Max characters for the input
Property Name
string name
OptType type
OptSubType sub_type
string value
Return Type Name Description
menu_combo has_flags(OptFlag flags) Sets flags
menu_combo tooltip(string tooltip) Sets the tooltip
menu_combo on_click(function callback(menu_combo)) Called when the option is pressed, scrolled or toggled depending on the type
menu_combo on_enter(function callback(menu_combo)) Called when the option is entered
menu_combo on_leave(function callback(menu_combo)) Called when the option is left
Operator Description
[player] Returns an instance to combo_player_lua_state
Property Name Description
string name
OptType type
OptSubType sub_type
number value The index into the list if the option is not a multi option
bool toggle The toggle value if this option type is OptScroll.TOGGLE
menu_combo_multi_state multi
menu_combo_list list The list of data
Return Type Name Description
menu_number has_flags(OptFlag flags) Sets flags
menu_number tooltip(string tooltip) Sets the tooltip
menu_number on_click(function callback(menu_number)) Called when the option is pressed, scrolled or toggled depending on the type
menu_number on_enter(function callback(menu_number)) Called when the option is entered
menu_number on_leave(function callback(menu_number)) Called when the option is left
menu_number step(number step) Sets the step amount
menu_number format(string fmt, number min, number max) Sets the formatter and the min/max values
Operator Description
[player] Returns an instance to number_player_lua_state
Property Name Description
string name
OptType type
OptSubType sub_type
number value
bool toggle The toggle value if this option type is OptScroll.TOGGLE

number_player_lua_state

Property Name Description
number value
bool toggle The toggle value if this option type is OptScroll.TOGGLE
Return Type Name Description
menu_combo_list at(number index) The data from the index
Property Name
string name
X value
Return Type Name Description
bool is_set(number index) Whether the index is set
nil set(number index, bool value) Sets this index
bool is_disabled(number index) Whether the index is disabled
nil disable(number index, bool value) Sets the index to be disabled
number count() The amount of states
bool is_active_ranged(number from, number to) Whether any index in the range is set
Property Name Description
string name
OptType type
OptSubType sub_type
string value
bool toggle The toggle value if this option type is OptScroll.TOGGLE

combo_player_lua_state

Property Name Description
number value The index into the list if the option is not a multi option
bool toggle The toggle value if this option type is OptScroll.TOGGLE
menu_combo_multi_state multi

Examples

For a more in depth example, please refer to our example projects.

-- Create a few options
local resize_id = 0
local root = menu.root()
local player = root:submenu('Player Options')
local vehicle = root:submenu('Vehicle Options')
local world = root:submenu('World Options')

local player_root = menu.player_root()

player_root:button('Notify Player Name')
  :on_click(function(opt)
    if players.is_session() then
      notify.push('cool script', 'session is selected', { icon = Notify.MODDER })
    else
      notify.push('cool script', players.selected().name, { icon = Notify.MODDER })
    end  
end)

local give_rp_toggle = player_root:toggle('Give RP')

util.create_thread(function()
  for i, player in ipairs(players.list()) do
    if give_rp_toggle.value or give_rp_toggle[player].value then -- If it's enabled for the session or this specific player
      print('Giving RP to', player.name)
    end

    -- ...other player feature loops
  end
end)

player:submenu('Resize On Enter Test')
  :on_enter(function(opt)
    opt:resize(0, function(opt) -- resize to 0 (remove all of the options)
      opt:button('Resize ' .. resize_id)
      resize_id = resize_id + 1
    end)
  end)

local t = player:toggle('testing')
print('current toggle: ', t.value)

player:number_int('Test', { type = OptScroll.PRESS })
  :format('%i', 0, 100):step(10)
  :on_click(function(opt)
    print('value changed to ' .. opt.value)
  end)

player:combo_int('testing', { { 'name1', 111 }, { 'name2', 123 } }, {})
  :on_click(function(opt)
    print('index:' .. opt.value)
    print('toggle:', opt.toggle)
    print('name:', opt.list:at(opt.value).name)
    print('value:', opt.list:at(opt.value).value)
  end)

player:combo_int('testing', { { 'name1', 111 }, { 'name2', 123 } }, { multi = true })
  :on_click(function(opt)
    print('index:' .. opt.value)

    for i = 1, #opt.list do
      print('index:', i, 'set:', opt.multi:is_set(i))

      if opt.multi:is_set(i) then
        print('\tname:', opt.list:at(i).name)
      end
    end
  end)