Exports
The public API of Aurora HUD, for hiding the HUD, pushing statuses and feeding widgets from your own scripts.
The resource is named aurora_hud, so every call is exports.aurora_hud:.... These are
state changes, not stop/start: the HUD keeps running throughout.
Showing and hiding
Section titled “Showing and hiding”Hides the whole HUD without stopping it: cutscenes, admin cameras, events.
exports.aurora_hud:SetHudVisible(false)exports.aurora_hud:SetHudVisible(true)
local newState = exports.aurora_hud:ToggleHud() -- returns the new state (boolean)local enabled = exports.aurora_hud:IsHudEnabled() -- reads the switch, ignoring pauselocal ready = exports.aurora_hud:IsHudReady() -- true once everything has loadedexports.aurora_hud:SetHudVisible(playerId, false) -- one playerexports.aurora_hud:SetHudVisible(-1, true) -- everyone (-1 or nil)The HUD is drawn only when enabled and ready and the game is not paused. Closing the pause menu does not undo a hide.
Ready means the player has joined, every server setting has answered, and the ped has
spawned. Until then the HUD is not drawn and /hud refuses to open.
Body status
Section titled “Body status”For standalone servers, or a separate hunger and stress system. Values are clamped to 0–100.
exports.aurora_hud:SetStatus({ hunger = 80, thirst = 60, stress = 20 })exports.aurora_hud:SetStatus(source, { hunger = 80, thirst = 60, stress = 20 })The server form returns true/false, failing on an invalid source or a second
argument that is not a table.
On a framework server these are a nudge rather than a source, the same as money: the framework’s next hunger, thirst or stress update overwrites them.
Player info
Section titled “Player info”Feeds the job and wallet widgets. Sending a field switches on the matching widget.
exports.aurora_hud:SetPlayerInfo({ jobLabel = 'Police', cash = 1500 })exports.aurora_hud:SetPlayerInfo(source, { jobLabel = 'Police', jobGrade = 'Sergeant', cash = 1500, bank = 42000,})cash and bank are clamped to integers ≥ 0; jobLabel and jobGrade are cut at 48
characters.
Stress
Section titled “Stress”Effective only while the HUD’s stress engine is on, set in /hud → Admin. Otherwise
stress comes from framework metadata and these are ignored.
exports.aurora_hud:AddStress(10) -- add, or subtract with a negativeexports.aurora_hud:SetStress(50) -- absolute, 0–100local s = exports.aurora_hud:GetStress() -- current value-- A deliberately non-net event, so only server code can reach itTriggerEvent('aurora_hud:server:addStress', source, 10)Seatbelt, indicators and cruise control
Section titled “Seatbelt, indicators and cruise control”Turn the HUD’s version off in /hud → Admin first.
exports.aurora_hud:SetSeatbelt(true)exports.aurora_hud:SetSignal(2) -- 0 off, 1 left, 2 right, 3 hazardsexports.aurora_hud:SetCruise(true, 90) -- active, km/hEach returns true if applied, or false if the HUD’s own version of that feature is on.
For the reverse, reacting when the HUD drives these, use the
Custom.OnSeatbeltChanged / OnSignalChanged / OnCruiseChanged hooks in
config/client.lua.
The widget reads pma-voice by default. SaltyChat and TokoVoip are wired in
config/client.lua, as is the call icon for lb-phone, qs-smartphone, gksphone and
roadphone.
exports.aurora_hud:SetVoice({ range = 2, -- 1 whisper, 2 normal, 3 shout talking = true, radioChannel = 42, -- 0 = radio off radioTalking = false, onCall = false,})The override is per field: sending only onCall leaves range and talking coming from
pma-voice.
For a script that exposes reads rather than firing events, define Custom.GetVoice() in
config/client.lua returning the same table. It is called from the HUD’s existing state
loop, so no extra thread is created.
Weapon widget
Section titled “Weapon widget”The widget reads the weapon in hand and its ammo from the game, so it works whichever inventory you run, or with none. The reserve beside the clip is the ammo the character carries for that weapon.
ox_inventory also reports which ammo item
the weapon uses, through ox_inventory:currentWeapon, and the reserve is then counted from
that item through Custom.GetItemCount. To do the same from another inventory, report the
weapon when it is equipped:
exports.aurora_hud:SetWeapon({ name = 'WEAPON_PISTOL', -- the game's weapon name: applies while that weapon is in hand label = 'Pistol', ammoType = 'ammo-9', -- item counted as reserve, optional durability = 100, -- optional: jerrycan / extinguisher level melee = false, -- optional: read from the game when left out})
exports.aurora_hud:SetWeapon(nil) -- holstered: back to what the game reportsDowned state
Section titled “Downed state”A player counts as down when a state bag key listed in
Custom.downed says so, when the framework’s data
says so, or when the ped dies. For an ambulance script that uses none of these:
exports.aurora_hud:SetDowned(true)exports.aurora_hud:SetDowned(false)Custom statuses
Section titled “Custom statuses”Pushes the value of a custom status whose source is set to Push in the /hud menu
builder. Nothing is polled; the value is sent only when it changes.
exports.aurora_hud:SetCustomStatus('safezone', true) -- static, on/offexports.aurora_hud:SetCustomStatus('radiation', 73) -- numbered, 0–100exports.aurora_hud:SetCustomStatus(playerId, 'safezone', true)Whether a status is static or numbered is decided in the menu, at definition time; this
export only delivers the value. Only number, boolean or nil are accepted, and
anything else is ignored.
Inventory counts and item use
Section titled “Inventory counts and item use”For an inventory that fires events rather than answering questions, from your own script
or from an adapter in config/client.lua:
exports.aurora_hud:SetItemCount('ammo-9', 42) -- after every count changeexports.aurora_hud:ItemUsed('joint') -- the player used an itemAfter the first SetItemCount, the HUD asks the inventory once per item and trusts the
pushes from then on, so an inventory that does not report every change should not use it.
ItemUsed feeds the stress items. With ox_inventory the HUD
does both on its own.
Widget lock items
Section titled “Widget lock items”The item that unlocks a locked widget must exist in your inventory and report its use to the HUD. How depends on the inventory.
ox_inventory, which every Qbox server runs: point the item’s client.export at the
HUD, then restart ox_inventory:
['gps'] = { label = 'GPS', client = { export = 'aurora_hud.useWidgetItem', },},QBCore or ESX with the framework’s inventory: nothing to wire. The HUD registers the item name from the menu as a usable item itself.
Another inventory: carried by the adapter in config/server.lua, through the
inventory’s own exports or a hand-written OnUse. See
Inventories.
Every use is validated server-side: the player must hold the item, and rapid repeats are dropped. Consumed or toggle is set per widget in the menu.
useWidgetItem is for widget locks only. For stress items, see
Stress.
Reporting an error
Section titled “Reporting an error”Other resources can add a line to the support report when they hit a problem with their HUD integration:
exports.aurora_hud:LogError('my-script', 'could not read value X')Entries are grouped by message with a counter, and the report keeps the 15 most recent from each side. It never includes player identifiers or database contents.