Skip to content

Integration ​

How to make your framework and other resources use np_hud's notifications, seatbelt, and progress bar.

Framework notifications ​

There are two ways to do it.

  1. Capture (no edits): set Config.CaptureFrameworkNotify = true. np_hud then also listens to the net events QBCore:Notify, esx:showNotification and ox_lib:notify. The framework's own UI still shows the message, so players see it twice. Capture only catches notifications the server sends through those events. Direct client calls (QBCore.Functions.Notify(...), ESX.ShowNotification(...), lib.notify(...)) never go through an event.
  2. Redirect (recommended): change the framework's notify function once so that every notification goes to np_hud, and leave CaptureFrameworkNotify = false. Each snippet below is a few lines. Keep them in a patch file, because a framework update overwrites them.

np_hud maps the type names itself (primary → info, warn → warning, danger → error, …).

lua
-- qb-core/client/functions.lua: replace the body of QBCore.Functions.Notify
function QBCore.Functions.Notify(text, texttype, length, icon)
  if GetResourceState('np_hud') == 'started' then
    local title, message = nil, text
    if type(text) == 'table' then title, message = text.caption, text.text end
    exports.np_hud:Notify({ title = title, message = message, type = texttype, duration = length, icon = icon })
    return
  end
  -- original body below (fallback when np_hud isn't running)
end
lua
-- es_extended/client/functions.lua
function ESX.ShowNotification(message, notifyType, length, title, position)
  if GetResourceState('np_hud') == 'started' then
    return exports.np_hud:Notify({ title = title, message = message, type = notifyType, duration = length })
  end
  return IsResourceFound('esx_notify') and exports['esx_notify']:Notify(notifyType or 'info', length or 5000, message, title, position)
end
lua
-- ox_lib/resource/interface/client/notify.lua: at the top of function lib.notify(data)
if GetResourceState('np_hud') == 'started' then
  return exports.np_hud:Notify({ title = data.title, message = data.description, type = data.type,
    duration = data.duration, icon = type(data.icon) == 'string' and data.icon or nil })
end
  • qb-core: the QBCore:Notify net event calls this function, so server-side TriggerClientEvent('QBCore:Notify', …) is covered too.
  • ESX: esx:showNotification calls this function, so server-side calls are covered too. GTA colour codes (~r~) are only stripped in capture mode. If your scripts use them, strip them in the snippet: message:gsub('~%a~', '').
  • ox_lib: ox_lib:notify is registered as RegisterNetEvent('ox_lib:notify', lib.notify), so one change covers client and server calls.
  • Qbox: qbx_core sends everything through ox_lib (Notify → lib.notify), so patch ox_lib. To change only qbx, edit qbx_core/client/functions.lua → Notify(...) and call exports.np_hud:Notify({ title = title, message = description, type = notifyType, duration = duration }) instead of lib.notify.

Seatbelt ​

np_hud owns the replicated state bag LocalPlayer.state.seatbelt, so the server can read Player(src).state.seatbelt.

  • Other resources read the state bag or call exports.np_hud:SetSeatbelt(true|false) / GetSeatbelt().
  • Another seatbelt script: set Config.Seatbelt.enabled = false, then have that script call LocalPlayer.state:set('seatbelt', on, true). The HUD icon follows the bag.
  • Cruise control: np_hud doesn't ship one. A cruise script can set LocalPlayer.state:set('cruise', true, false) and the vehicle zone shows the indicator.

Stance (crouch / prone) ​

np_hud reads the replicated state bags that np_crouch-crawl-shoot publishes and shows an on-foot chip above the weapon card (bottom right). No setup needed, and the start order doesn't matter.

Bags Chip
stance = 'crouch' grey, Crouching
stance = 'prone' grey, Prone (Prone · on back with proneType = 'back')
stance = 'prone', proneDeployed = true rust, Prone · deployed
'stand', unset, or in a vehicle hidden

Stance chip: before and after, with the three states

Rendered from the web dev mode (?scene=foot&stance=…) with mock data, not an in-game capture.

The chip also shows unarmed, belongs to the bottom-right zone (it fades out with a zone claim), and Config.Components.stance = false turns it off. Any other crouch / prone script can drive it by setting the same bags:

lua
LocalPlayer.state:set('stance', 'crouch', true)
LocalPlayer.state:set('stance', 'stand', true)  -- hides it

While np_hud runs, np_crouch-crawl-shoot hides its own fallback stance pill and uses np_hud's prompts and notifications for its key hints and messages.

Aircraft ​

The helicopter and plane panels have one indicator each that np_hud can't detect, because GTA has no hover hold or autopilot. A flight script sets a local state bag and the tile lights up blue:

lua
LocalPlayer.state:set('hover', true, false)     -- helicopter: hover hold, label "Hover hold"
LocalPlayer.state:set('autopilot', true, false) -- plane: autopilot

Set them back to false when the mode ends. Rotor health, searchlight, landing gear and the boat anchor come from natives and need no integration.

Progress bars ​

To replace progressbar or ox_lib's progressBar, call exports.np_hud:Progress(...). See Progress bars.

Interaction prompts ​

Call ShowPrompt / HidePrompt from ox_target, from zone scripts or from your own resources. See Interaction prompts.

Sharing the screen with other UIs ​

A UI that only covers part of the screen claims the HUD zones underneath it instead of hiding the whole HUD. Claimed zones fade out, and toasts move to the free top corner (they stay top-right when both top corners are claimed):

lua
exports.np_hud:ClaimZones({ 'top-right', 'bottom-right' })  -- e.g. a menu docked on the right
exports.np_hud:ClaimZones('all')                            -- a full-screen UI
exports.np_hud:ClaimZones(false)                            -- release

Zones: top-right (status chips and toasts), top-left, top-center (announcements), center (prompts, progress), bottom-left (map column and native minimap), bottom-right (vehicle / weapon / stance chip) and bottom-center. Claims are kept per calling resource. Pass a tag as the second argument to hold several at once (ClaimZones('all', 'camera')). np_hud drops a resource's claims when it stops.

np_menu and np_inventory claim their zones automatically while they are open. np_fishing claims the zones its fishing HUD draws over while a line is in the water. np_golf claims the corners its golf HUD uses while you play or spectate, and every zone while a golf menu is open. np_darts claims its zones while a player throws and while a darts menu is open. np_billiards claims its zones while you play or spectate at a table. np_minigames claims center, top-center and bottom-center (the zones under its game card, Config.Integrations.hudZones) while a game or its arcade is open.

Cutscenes and other UIs ​

Hide the HUD while another full-screen UI is open:

lua
exports.np_hud:SetVisible(false)
-- ...
exports.np_hud:SetVisible(true)

The HUD also hides itself while the pause menu is open, while the character is loading, and when the player turns it off with /hud.

np_helicam ​

No setup needed. np_hud listens for np_helicam's local client events:

  • np_helicam:fullscreen: the HUD hides while the helicopter camera or a ground unit's live feed is up. np_helicam draws its own overlay there.
  • np_helicam:contextMap: while np_helicam has the minimap (camera context map or the F7 Air Support map), the HUD hides and leaves the minimap alone. When np_helicam gives the minimap back, np_hud re-applies its own layout.

If np_hud starts while the camera is already up, it asks np_helicam's client exports IsFullscreen and IsMinimapHeld. Start order doesn't matter.