Skip to content

Integration ​

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

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.

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.

Inventories ​

Push the hotbar from your inventory with SetHotbar. See Hotbar.

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.

np_* FiveM resources