Note
Client side. Enabled with Config.NewPrompts.enabled = true. Existing native prompts keep working.
local gum = exports.gumApi:gumApi()
gum.createNewPrompt("open_shop", {
label = "Open shop",
key = "E",
visible = false,
event = "myScript:openShop",
})
gum.showNewPrompt("open_shop", true) -- show
gum.showNewPrompt("open_shop", false) -- hideA prompt is owned by the resource that created it. Two resources can use the same id without colliding, and a resource's prompts are removed when it stops.
Functions#
| Function | Returns | Description |
|---|---|---|
createNewPrompt(id, options) |
id, or false and a message |
Creates a prompt. The id is a string of 1 - 100 characters, unique inside your resource |
showNewPrompt(id, visible) |
boolean | Shows or hides one prompt |
hideNewPrompt(id) |
boolean | Same as showNewPrompt(id, false) |
setNewPromptEnabled(id, enabled) |
boolean | Greys a prompt out without hiding it |
updateNewPrompt(id, options) |
boolean | Changes label, keyLabel, group or data while it exists |
deleteNewPrompt(id) |
boolean | Removes the prompt |
showNewPromptGroup(group, visible) |
boolean | Shows or hides every prompt of your resource that has this group |
resolvePromptControl(name) |
key number or nil | Converts a key name or control hash to a key |
Options#
| Option | Type | Default | Meaning |
|---|---|---|---|
label |
string | the id | Text, up to 200 characters |
key |
string or number | Key name or Windows virtual key number | |
control |
number or string | Native control hash, used to find a matching key | |
keyLabel |
string | the key name | Text inside the key box, up to 24 characters |
visible |
boolean | false | Start visible |
enabled |
boolean | true | Can be pressed |
hold / holdMs |
boolean or number | 0 | Hold time. true = 1000 ms, maximum 60000 |
cooldownMs |
number | 250 | Time before the prompt can fire again |
repeatMs, repeatDelayMs |
number | 0, 400 | Repeat while the key is held |
priority |
number | 0 | Ordering weight, -10000 to 10000 |
order, section, sectionOrder |
Sorting and the section (keys, arrows, mouse or your own name) |
||
group |
string | Name used with showNewPromptGroup |
|
event |
string | Client event triggered with (id, data) when the prompt fires |
|
onPress |
function | Called with (id, data) instead of an event |
|
data |
any | Passed to event or onPress |
|
blockGameControls, blockAllControls |
boolean | from config | Block the matching game action, or every action, while visible |
Note
The mouse wheel can be scrolled but not held. Using hold on a wheel prompt returns false and a message.
Events#
event is triggered locally on the client with the prompt id and your data. A plain AddEventHandler is enough. Use RegisterNetEvent only if the server must be able to fire the same event, and then validate everything it receives.