# Exports and Events (/docs/orbit-studios-resources/orbit-dynamichud-addons/exports-and-events)



# Exports and Events [#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.

<TypeTable
  type="{
  'LocalPlayer.state.seatbelt': {
    type: 'boolean',
    description: 'True when the player has the seatbelt enabled.',
  },
  'LocalPlayer.state.cruise': {
    type: 'boolean',
    description: 'True when cruise control is active.',
  },
  'LocalPlayer.state.harness': {
    type: 'boolean',
    description: 'Optional external harness state checked by the seatbelt script.',
  },
  'seatbelt:client:ToggleSeatbelt': {
    type: 'client event',
    description: 'Triggered locally when the seatbelt state toggles.',
  },
  'seatbelt:client:ToggleCruise': {
    type: 'client event',
    description: 'Triggered locally when cruise state toggles.',
  },
  'exports[&#x22;orbit-dynamichud-addons&#x22;]:HasHarness()': {
    type: 'client export',
    description: 'Deprecated compatibility export. Prefer LocalPlayer.state.harness.',
  },
}"
/>

## Read Current State [#read-current-state]

```lua title="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 [#listen-for-toggles]

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

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

## Harness Compatibility [#harness-compatibility]

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

```lua title="resources/[custom]/client/harness.lua"
local hasHarness = exports['orbit-dynamichud-addons']:HasHarness()
```

```lua title="resources/[custom]/client/harness.lua"
LocalPlayer.state.harness = true
```
