F5 StudioF5 Studio
Skip to main content

Integration

gta6_weaponhud does not know which HUD you run. Instead it measures its own height in the NUI and publishes it, so any HUD can react.

Event: gta6_weaponhud:state

A local client event with two arguments:

ArgumentTypeMeaning
visiblebooleanWhether the block is on screen
heightnumberHeight of the block in screen pixels (0 when hidden)

It fires:

  • whenever visibility or height changes (the NUI measures offsetHeight after every update and after the icon loads or fails to load);
  • when any other resource starts, immediately and again two seconds later, so a HUD started after gta6_weaponhud receives the current state.

Export: GetState

Client-side
local visible, height = exports.gta6_weaponhud:GetState()

Returns the same two values on demand.

Example: move a money block under the weapon block

Lua side of the other HUD:

Client-side (your HUD)
AddEventHandler('gta6_weaponhud:state', function(visible, height)
SendNUIMessage({ action = 'weaponhud', visible = visible, height = height })
end)

NUI side:

app.js (your HUD)
case 'weaponhud':
document.querySelector('#money').style.setProperty(
'--weapon-h',
data.visible ? `calc(${data.height}px + 10 * var(--u))` : '0px'
);
break;
style.css (your HUD)
.money { top: calc(3vh + var(--weapon-h, 0px)); transition: top 0.3s ease; }

With that, the money block sits at its usual place while unarmed and slides down by the block height plus a 10-unit gap while a weapon is drawn.

A HUD that does not want to integrate can simply give gta6_weaponhud a different corner through Config.Position.