Exports & API

legends_hud exposes seven client-side events that let custom scripts feed values into the HUD without modifying its source. Use these when you run a non-standard medical, voice, or status system that the auto-detection layer doesn't cover.

All events are triggered with TriggerEvent on the client of the player whose HUD should update.

lhud:setNeeds

Pushes hunger, thirst, and stamina values into the vitals bars.

TriggerEvent('lhud:setNeeds', {
    hunger  = 85.0,   -- 0-100
    thirst  = 70.0,   -- 0-100
    stamina = 100.0,  -- 0-100
})

Use case: Custom hunger / thirst systems that don't run through the framework's standard player object.


lhud:setStress

Sets the stress meter.

TriggerEvent('lhud:setStress', 42.5)  -- 0-100

Use case: Custom stress system, scripted stress events (gunfights, chases, panic moments).

The stress meter is hidden if profile.toggles.stressMeter is set to false in config.lua.


lhud:setVoiceStep

Forces the voice proximity tier to whisper, normal, or shout.

TriggerEvent('lhud:setVoiceStep', 1)  -- 1 = whisper, 2 = normal, 3 = shout

Use case: Custom voice plugins that don't use pma-voice's standard talking-mode events. Map your plugin's mode to one of the three tiers and forward it.


lhud:setRadioActive

Tells the HUD whether the player is currently transmitting on radio.

TriggerEvent('lhud:setRadioActive', true)   -- transmitting
TriggerEvent('lhud:setRadioActive', false)  -- idle

Use case: Custom radio plugins (e.g., scripted long-range radios) that should drive the HUD's radio indicator.


lhud:suppressHud

Temporarily hides the entire HUD overlay (vitals + vehicle + voice).

TriggerEvent('lhud:suppressHud', true)   -- hide
TriggerEvent('lhud:suppressHud', false)  -- restore

Use case: Cinematic camera scripts, cutscenes, photo mode, or any context where you want a clean screen.


lhud:suppressRadar

Hides the minimap independently of the rest of the HUD.

TriggerEvent('lhud:suppressRadar', true)   -- hide minimap only
TriggerEvent('lhud:suppressRadar', false)  -- restore

Use case: Pause menus, custom map UIs, mission scripts that want the player navigating without GPS.


lhud:setIncapacitated

Forces the HUD into the incapacitated state (vitals dim, restraint disabled, certain widgets hidden).

TriggerEvent('lhud:setIncapacitated', true)   -- mark as down
TriggerEvent('lhud:setIncapacitated', false)  -- mark as alive

Use case: Custom medical scripts that don't go through one of the auto-detected ambulance jobs. Pair with lhud:suppressHud for full death camera scenes.


Server-Side Events

The HUD is mostly client-side. The only server-side responsibility is forwarding incapacitation state from your medical script to the player's client via the standard medical events the bridge already listens to (hospital:server:SetDeathStatus, wasabi_ambulance:setDeathStatus, codem-ambulance:server:setDeathState, esx_ambulancejob:setDead, etc.).

If you run a custom medical script, trigger lhud:setIncapacitated on the affected client whenever your script flips death state.

There are no server-side exports to call — the HUD intentionally avoids server-side per-tick work. All state lives on the client whose HUD is being updated.

Custom Integration Recipe

If you run an entirely custom stack that auto-detection can't handle, the typical glue script looks like this:

-- client.lua (in your custom integration resource)
RegisterNetEvent('mystack:onStatusUpdate', function(payload)
    TriggerEvent('lhud:setNeeds', {
        hunger  = payload.hunger,
        thirst  = payload.thirst,
        stamina = payload.stamina,
    })
    TriggerEvent('lhud:setStress', payload.stress)
end)
 
RegisterNetEvent('mystack:radio:transmit', function(active)
    TriggerEvent('lhud:setRadioActive', active)
end)
 
RegisterNetEvent('mystack:medical:downed', function()
    TriggerEvent('lhud:setIncapacitated', true)
end)
 
RegisterNetEvent('mystack:medical:revived', function()
    TriggerEvent('lhud:setIncapacitated', false)
end)

Pin Config.Integrations.Medical = 'standalone' in config.lua so the bridge doesn't fight your custom hooks.


Legends Store - Premium FiveM Scripts