#
ui
Responsible for creating and managing menu elements within the cheat interface.
#
Functions
ui.create_groupbox(tab: string, side: string, name: string, height: number)
- Creates a groupbox within the specified tab of the menu.
secret.ui.create_groupbox("lua", "right", "elements", 200)
ui.create_checkbox(tab: string, groupbox: string, name: string, config_name: string): number
- Creates a checkbox UI element within the specified tab and groupbox of the menu.
- Returns a numeric ID for the created element that can be used to update or remove it later.
ui.create_button(tab: string, groupbox: string, name: string, callback: function): number
- Creates a checkbox UI element within the specified tab and groupbox of the menu.
- Returns a numeric ID for the created element that can be used to update or remove it later.
ui.create_slider(tab: string, groupbox: string, name: string, min: number, max: number, config_name: string): number
- Creates a slider UI element within the specified tab and groupbox of the menu.
- Returns a numeric ID for the created element that can be used to update or remove it later.
ui.create_colorpicker(tab: string, groupbox: string, name: string, config_name: string): number
- Creates a colorpicker UI element within the specified tab and groupbox of the menu.
- Returns a numeric ID for the created element that can be used to update or remove it later.
ui.create_inputbox(tab: string, groupbox: string, name: string, config_name: string): number
- Creates an inputbox UI element within the specified tab and groupbox of the menu.
- Returns a numeric ID for the created element that can be used to update or remove it later.
ui.create_hotkey(tab: string, groupbox: string, name: string, config_name: string): number
- Creates a hotkey UI element within the specified tab and groupbox of the menu.
- Returns a numeric ID for the created element that can be used to update or remove it later.
secret.ui.create_groupbox("lua", "right", "elements", 200) -- create a groupbox called "elements"
-- create and check lua hotkeys
secret.ui.create_hotkey("lua", "elements", "my hotkey", "lua_hotkey")
if secret.config.get("lua_hotkey") then
print("our lua hotkey is on!")
end
ui.create_dropdown(tab: string, groupbox: string, name: string, config_name: string, items: table, multi: boolean): number
- Creates a dropdown UI element within the specified tab and groupbox of the menu.
- Returns a numeric ID for the created element that can be used to update or remove it later.
secret.ui.create_groupbox("lua", "right", "elements", 200) -- create a groupbox called "elements"
secret.ui.create_dropdown("lua", "elements", "My Lua Dropdown", "lua_dropdown", {"Item1", "Item2", "Item3"}, false)
ui.create_playerlist_text(text: string, index: number): number
- Creates a text UI element in the 'advanced' tab of the player identified by the given index.
- Returns a numeric ID for the created element that can be used to update or remove it later.
ui.create_playerlist_button(name: string, index: number, callback: function): number
- Creates a button UI element in the 'advanced' tab of the player identified by the given index.
- Do note that the callback will return the index as a param.
- Returns a numeric ID for the created element that can be used to update or remove it later.
ui.update(index: number, new_value: string|table)
- Updates the UI element at the given index.
secret.ui.update(checkbox_id, "New Checkbox Label") -- update checkbox/button/inputbox label
secret.ui.update(button_id, "New Button Label")
secret.ui.update(inputbox_id, "New Input Label")
secret.ui.update(dropdown_id, {"NewItem1", "NewItem2"})
secret.ui.update(slider_id, { min = 0, max = 100 })
ui.remove(index: number)
- Removes the UI element at the given index.
secret.ui.remove(checkbox_id)
ui.update_groupbox(tab: string, groupbox_name: string, update_value: string|table|number)
- Updates properties of an existing groupbox.
-- update groupbox name
secret.ui.update_groupbox("lua", "elements", "new_elements")
-- update multiple properties
secret.ui.update_groupbox("lua", "elements", { name = "new_elements", side = "left", height = 150 })
-- update height only
secret.ui.update_groupbox("lua", "elements", 300)
ui.remove_groupbox(tab: string, groupbox_name: string)
- Removes the specified groupbox.
secret.ui.remove_groupbox("lua", "elements")
ui.clear_elements()
- Clears all the current elements made with lua, such as secret.ui.create_checkbox, etc.
ui.menu_open(): boolean
- Returns a boolean value of the menu being open.
ui.console_open(): boolean
- Returns a boolean value of the console being open.
ui.notify(text: string, type: number)
- Creates a new notification at the top left corner of the screen with the specified text and type.
- 0 = Default
- 1 = Warning
- 2 = Error
ui.is_keybind_active(keybind_name: string, absolute?: boolean = false): boolean
- Checks if a specified keybind is currently active/pressed.
- Only works with built-in cheat features, not Lua-specific keybinds.
-- check thirdperson with absolute=false (default) - returns true if in "always" mode or not bound
if secret.config.get("misc_thirdperson") and secret.ui.is_keybind_active("thirdperson") then
print("thirdperson is enabled (always mode or key not bound)")
end
-- check thirdperson with absolute=true - only returns true if key is physically pressed --> this is what the 'hotkeys' uses.
if secret.config.get("misc_thirdperson") and secret.ui.is_keybind_active("thirdperson", true) then
print("thirdperson key is currently being pressed")
end