Exports ​
All exports are called as exports.np_menu:<name>(...). The OOP wrapper wraps the menu
exports in an object.
Client ​
client
Menus ​
| Export | Returns | Description |
|---|---|---|
register(def) |
id | nil |
Register or replace a menu. See Creating menus |
open(id, opts?) |
boolean |
Open a menu. opts = { selectedId?, keepStack? } |
close(reason?) |
boolean |
Close the whole list / grid stack |
closeMenus(reason?) |
true |
Close everything np_menu shows on this client (list menus, context, radial, input / confirm dialog) and release NUI focus, e.g. before another resource takes the screen. Open menus get onClose(reason), default 'external'. Client twin of the server closeMenus(source); np_minigames calls it when a local game opens |
back() |
boolean |
Go back one level (closes the root if canClose) |
isOpen() |
boolean |
A list / grid menu is open |
getOpenId() |
id | nil |
The menu on top of the stack |
inStack(id) |
boolean |
id is anywhere in the open stack |
exists(id) |
boolean |
id is registered |
remove(id) |
boolean |
Close it if visible, then unregister |
refresh(id?) |
Re-render the visible menu (re-evaluates permissions and format) |
|
update(id, patch) |
boolean |
Patch header fields (title, subtitle, icon, tint, position, skin, search, searchDeep, counter, canClose, preview, cart, tag, callbacks, allowDead). items / dock replace those lists |
setItems(id, items) |
boolean |
Replace all rows |
addItem(id, item, index?) |
itemId | nil |
Append, or insert at index |
removeItem(id, itemId) |
boolean |
|
updateItem(id, itemId, patch) |
boolean |
Patch one row. false clears a field (badge, cooldown, rightLabel, …) |
getItem(id, itemId) |
WireItem | nil |
Serialized copy of the row (no functions) |
setPreview(id, card | nil) |
boolean |
Preview card next to the menu |
setCart(id, cart | nil) |
boolean |
Cart footer { label, total, action } |
Dialogs and toasts ​
| Export | Returns | Description |
|---|---|---|
inputDialog(def) |
values | nil |
Blocking. { [fieldId] = value }, nil when cancelled. See Dialogs |
confirm(def | message) |
boolean |
Blocking. |
notify(data) / notify(title, type?) |
boolean |
Toast { type, title, message?, icon?, tint?, duration?, app? } |
clipboard(text) |
boolean |
Copy text to the player's clipboard |
Radial and context ​
| Export | Returns | Description |
|---|---|---|
addRadial(context, item) |
id |
context: string or list. See Radial wheel |
removeRadial(id) |
boolean |
|
setRadialContext(fn) |
boolean |
Add a provider fn(info) -> 'context' | { … } | nil |
openRadial(context?) |
boolean |
Open the wheel from code |
closeRadial() |
boolean |
|
isRadialOpen() |
boolean |
|
showContext(def | menuId, entity | vector3) |
id | nil |
World-anchored context menu. See Context menus |
closeContext() |
boolean |
|
isContextOpen() |
boolean |
|
addContextOption(entityType, option) |
id | nil |
Only with the built-in context menu. See addContextOption |
removeContextOption(id) |
boolean |
Settings and server ​
| Export | Returns | Description |
|---|---|---|
getSettings() |
table |
Merged player settings. See Theming & settings |
setSetting(key, value) |
boolean, err? |
nil resets the key to its default |
callServer(name, payload?, opts?) |
ok, data | code, message? |
Blocking server action call. opts = { silent?, timeout? }. See Server actions |
exports.np_menu:register({ id = 'demo', title = 'Demo', items = { { type = 'button', id = 'hi', label = 'Hello' } } })
exports.np_menu:open('demo')
exports.np_menu:updateItem('demo', 'hi', { badge = 3 })
CreateThread(function()
local name = exports.np_menu:inputDialog({ title = 'Name', fields = { { id = 'n', label = 'Name', required = true } } })
if name then exports.np_menu:notify({ type = 'success', title = 'Hi ' .. name.n }) end
end)
Walk style ​
Only while the built-in quick menu is on (Config.Builtin.quick). For resources that change the movement clipset and
need to put the player's walk style back afterwards, e.g. np_crouch-crawl-shoot
when leaving crouch.
| Export / event | Returns | Description |
|---|---|---|
getWalkstyle() |
string | nil |
The walk clipset picked in the quick menu's Walk style (e.g. 'move_m@brave'). nil = default walk |
np_menu:reapplyWalk (local event) |
Re-applies the stored walk style now, or resets the movement clipset when none is stored |
-- done with your own movement clipset: hand the walk back to np_menu
ResetPedMovementClipset(PlayerPedId(), 0.25)
TriggerEvent('np_menu:reapplyWalk')
-- or read it and apply it yourself
local walk = exports.np_menu:getWalkstyle() -- 'move_m@brave' | nil
With Config.OxCompat = true there are more exports with ox_lib signatures. See ox_lib compatibility.
Events ​
Local client events (AddEventHandler): np_menu:opened, np_menu:closed, np_menu:selected, np_menu:changed,
np_menu:radialOpened, np_menu:contextOpened, np_menu:contextClosed, np_menu:settingChanged. See
Creating menus → Events. np_menu listens to np_menu:reapplyWalk (see Walk style).
Server ​
server
| Export | Returns | Description |
|---|---|---|
registerAction(name, opts) |
boolean |
Register a server action. See Server actions |
removeAction(name) |
boolean |
|
notify(source, data) |
Toast on one client | |
closeMenus(source) |
Close every np_menu surface on that client (-1 = everyone) |
|
resetAce(source?) |
true |
Deprecated no-op. np_menu no longer uses FiveM ACE; np_admin pushes permission changes to the clients itself |
exports.np_menu:notify(source, { type = 'info', title = 'Garage', message = 'Your car is **ready**.', icon = 'car' })
exports.np_menu:closeMenus(source)
Server events (built-in menus) ​
| Event | Arguments | Fired after |
|---|---|---|
np_menu:shops:tuningBought |
src, netId, changes, price |
A tuning purchase |
np_menu:shops:clothingBought |
src, changes, price |
A clothing purchase |
np_menu:interact:impounded |
src, plate, model |
An impound from the context menu |
These are local server events, fired only after the server validated the action.
Commands ​
| Command | Side | Description |
|---|---|---|
devmenu |
client | Shim: opens np_admin's quick menu while np_admin is started (the admin menu moved there, see Built-in menus → Admin menu) |
quickmenu |
client | Toggle the quick menu (F1) |
menusettings |
client | Open the settings menu |
+np_menu_radial, +np_menu_context, +np_menu_cursor, +np_menu_shopcam |
client | Key mappings (hold radial, hold context, cursor toggle, shop camera) |