Orbit StudiosOrbit Studios
Orbit Studios Resourcesorbit-dynamichud-addons

Exports and Events

State bags, client events, and exports available in orbit-dynamichud-addons.

Exports and Events

The addon communicates through local player state bags and local client events. DynamicHUD reads the same state values, so custom resources can use them too.

Client-side integration

These state values, events, and the compatibility export belong to the client. Server resources should not assume local-only seatbelt or cruise state is automatically replicated.

Prop

Type

Read current state

resources/[custom]/client/main.lua
local seatbeltOn = LocalPlayer.state.seatbelt == true
local cruiseOn = LocalPlayer.state.cruise == true
local harnessOn = LocalPlayer.state.harness == true

State bag values are local booleans. They can be nil before the player enters a vehicle, so compare with == true when you need a strict boolean.

Listen for toggles

resources/[custom]/client/seatbelt-listener.lua
AddEventHandler('seatbelt:client:ToggleSeatbelt', function()
    local seatbeltOn = LocalPlayer.state.seatbelt == true
end)
resources/[custom]/client/cruise-listener.lua
AddEventHandler('seatbelt:client:ToggleCruise', function()
    local cruiseOn = LocalPlayer.state.cruise == true
end)

Harness compatibility

HasHarness() is kept for older integrations, but new code should read the state bag directly.

resources/[custom]/client/harness.lua
local hasHarness = exports['orbit-dynamichud-addons']:HasHarness()
resources/[custom]/client/harness.lua
LocalPlayer.state.harness = true

Integration checklist

  1. Compare state values with == true because they can be nil before initialization.
  2. Listen for toggle events only when an immediate reaction is needed; otherwise read current state at the point of use.
  3. Let one resource own writes to seatbelt and cruise state.
  4. Prefer LocalPlayer.state.harness over the deprecated compatibility export for new integrations.
  5. Clear or update external harness state when the harness is removed so ejection logic does not remain protected incorrectly.

On this page