Skip to content

Prompts, progress & hotbar ​

Prompts and progress

Interaction prompts ​

A centred prompt with up to 4 key caps. The same id replaces an existing prompt.

lua
-- e.g. from ox_target or a zone script
exports.np_hud:ShowPrompt({ id = 'atm', icon = 'credit-card', keys = { { key = 'E', label = 'Use ATM' } } })

-- shorthand for a single key
exports.np_hud:ShowPrompt({ id = 'dumpster', icon = 'box-open', key = 'E', label = 'Search' })

exports.np_hud:HidePrompt('atm')   -- or HidePrompt() to hide all
FieldNotes
idstring ≤ 64, default 'prompt'
icon, tintOptional tile
keys{ key, label }[], max 4. key ≤ 12 chars (upper-cased), label ≤ 48

np_hud only draws the prompt. Your script still listens for the key itself.

Progress bars ​

Progress blocks, so call it from a thread. It returns true when the bar finished and false when it was cancelled.

lua
CreateThread(function()
  local ok = exports.np_hud:Progress({
    label = 'Repairing', icon = 'wrench', duration = 8000, tint = 'orange',
    canCancel = true,
    disable = { movement = true, vehicle = true, combat = true },
  })
  if ok then
    -- finished
  end
end)

exports.np_hud:CancelProgress()     -- → true if a bar was cancelled
exports.np_hud:IsProgressActive()   -- → boolean
FieldNotes
labelRequired, ≤ 64
durationRequired, ms, 1–600000
icon, tint, idOptional
canCancelDefault true. Shows the cancel key (hudcancel, default X)
disable.movementBlocks move, sprint, jump, duck
disable.vehicleBlocks steering, accelerate, brake, exit
disable.combatBlocks attack, aim, melee, weapon wheel

The bar returns false when:

  • the player pressed the cancel key, or CancelProgress() was called
  • the player died
  • the resource stopped
  • another bar is already running. Progress() returns false immediately and doesn't queue the new bar.

Animations and props

np_hud doesn't play animations or attach props. Start your animation before the call and stop it afterwards.

Hotbar ​

Turn on Config.Components.hotbar, then have your inventory push the slots:

lua
exports.np_hud:SetHotbar({
  { slot = 1, label = 'Pistol', icon = 'gun' },
  { slot = 2, label = 'Bandage', icon = 'kit-medical', tint = 'red', count = 3 },
}, 1) -- selected slot

Up to 10 slots. With Config.Hotbar.autoHide = 3000, each SetHotbar call shows the hotbar, and it hides again after 3 s. Pass a third argument to force it: SetHotbar(slots, selected, false) hides it right away. A slot without an icon renders as empty.

Weapon and hotbar

np_* FiveM resources