NX CreativeNX CreativeDocs
Scriptsnx_hud

Installation

Requirements, replacing ox_lib, ox_inventory and ox_target with nx_hud, moving your inventory data and item images, and first-start checks.

This page covers what nx_hud needs beyond the generic installation guide. Because nx_hud takes the place of ox_lib, ox_inventory and ox_target, installing it means removing those three. Read the whole page before you start.

Requirements

  • FXServer artifact 7290 or newer, with OneSync on.
  • For the inventory: ESX or Qbox. The HUD, the ox_lib layer and targeting also work on QBCore or with no framework.
oxmysql
Required

Database access for the inventory. It uses ox_inventory's own tables, so an existing server keeps its data.

es_extended or qbx_core
Optional

Needed for the inventory, which attaches to one of them. The HUD reads hunger, thirst, stress and money from ESX, QBCore or Qbox.

pma-voice
Optional

Optional. The voice range shown on the island.

nx_mechanic
Optional

Optional. A service light in the vehicle HUD when the car is due for a service or has a failed part. Nothing to set up.

ox_lib, ox_inventory, ox_target, qtarget and qb-target come off the server. The steps below show how.

What it replaces

ResourceWhat nx_hud answers as
ox_libox_lib 3.36.4
ox_inventoryox_inventory 2.48
ox_targetox_target 1.18.1
qtargetthe same API as ox_target
qb-targetqb-target 5.5.0

Scripts that use @ox_lib/init.lua, exports.ox_inventory, exports.ox_target, exports.qtarget or exports['qb-target'], or list those resources as a dependency, find nx_hud in their place. The APIs are documented by Overextended: ox_lib, ox_inventory and ox_target.

Install

  1. Back up your database: the ox_inventory table and your framework's player and vehicle tables.
  2. Put the nx_hud folder in your resources folder.
  3. In your server config, put ensure nx_hud where ensure ox_lib was, before your framework. Delete the ensure ox_lib, ensure ox_inventory, ensure ox_target, ensure qtarget and ensure qb-target lines.
  4. Move the ox_lib, ox_target, qtarget and qb-target folders out of resources, including copies inside [category] folders. Leave the ox_inventory folder where it is for now: the next steps read your data from it.
  5. If your config grants ACE permissions to resource.ox_lib, grant the same ones to resource.nx_hud.
  6. Restart the whole server, with nobody connected. The console says the inventory is off because a folder named ox_inventory is still installed. That is expected at this step.
  7. In the server console, run nxinv migrate check from=<full path to your ox_inventory folder>. It should end with PREFLIGHT: GO.
  8. Run nxinv migrate apply from=<the same path>. It copies your items, shops, stashes, crafting and other data into nx_hud/data/, and the images your items use into nx_hud/web/images/. It should end with validated.
  9. Move the ox_inventory folder out of resources and keep it as a backup. Your inventory:* convars keep working.
  10. Restart the whole server.
# server.cfg: the start of the list
ensure oxmysql
ensure nx_hud        # where ensure ox_lib was

# your framework core (es_extended or qbx_core) and the rest go here

For step 5: Qbox's permissions.cfg usually grants these four to resource.ox_lib. Grant them to nx_hud instead:

add_ace resource.nx_hud command.add_ace allow
add_ace resource.nx_hud command.remove_ace allow
add_ace resource.nx_hud command.add_principal allow
add_ace resource.nx_hud command.remove_principal allow

Always restart the whole server after changing nx_hud. Never run restart nx_hud with players online: every script that depends on ox_lib stops with it. Never start ox_lib, ox_inventory, ox_target, qtarget or qb-target next to it.

A server that never ran ox_inventory

Skip steps 7 to 9. data/ ships with a starter set: a few items and weapons, four shops (a corner store, Ammu-Nation, a police armoury and a vending machine), one crafting bench and a weapon licence. Replace them with your own (see Customization).

Item images

web/images/ ships empty. nxinv migrate apply fills it with the images your items use. To add one yourself, put a PNG named after the item in nx_hud/web/images/, for example water.png.

nx_hud points the inventory:imagepath convar at its own image folder, so scripts that build image links from that convar find the pictures.

The migrate tool copies only the images your items reference, so the resource stays under the number of files a client can download on connect. NxInventory.fileBudget sets that limit, and the all and force options of nxinv migrate apply override it. See Commands.

Targeting

  • Scripts written for ox_target, qtarget or qb-target need no changes. The target key is Left Alt, as in ox_target, and the ox_target:* convars still work.
  • If a folder named ox_target, qtarget or qb-target is still in resources, nx_hud turns targeting off and says so in the console. The same happens when another resource declares provide for one of those names. Move the folder out and restart the server.
  • Settings are in config/target.lua, including whether idle target dots show (dots.enabled). Each player picks only the look in F7: Tether (the default) or Bloom.

First configuration

Check these before the first start:

  • config/hud.lua: Config.framework, Config.fuel and Config.seatbelt detect your scripts on 'auto'. Name one if detection picks the wrong script.
  • config/compat.lua: radialKey is G by default.
  • config/settings.lua: the F7 settings every player starts with, such as km/h instead of mph or a lighter glass. Players can still change their own.
  • inventory:framework: nx_hud sets it when it is empty, from the framework it finds (qbx_core, then es_extended). Set it yourself in server.cfg if you run both.

Everything under config/, data/ and the locale folders is plain text in the release. See Customization for the full list of files you can edit.

Troubleshooting

SymptomCheck
The inventory does not open, and the console says it is offnxinv status in the server console. A folder named ox_inventory in resources, or another resource that provides ox_inventory, keeps the inventory off.
Money or items do not follow the frameworknxinv bridge shows the selected framework bridge and whether it is attached.
Targeting does nothingnxtarget status in the server console. A leftover ox_target, qtarget or qb-target folder turns it off.
Hunger, thirst, fuel or the seatbelt read wrong/hud bridge in F8 prints which framework, fuel and seatbelt adapters answer.
Item pictures are missingCheck that nx_hud/web/images/ has a file named after the item.

Credits

The target menu icons are from Font Awesome Free 6.7.2 by Fonticons, Inc. (fontawesome.com), licensed under CC BY 4.0.

NX Docs