> ## Documentation Index
> Fetch the complete documentation index at: https://docs.awokenlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Exports and events

> Telling your own HUD, emote wheel or phone that the pause menu is open.

The menu hides the game's own HUD for you. Anything drawn in its own NUI is a different resource and a different browser page, so nothing the menu does to the game reaches it. These are the four ways to find out it is open.

## Exports

<ParamField path="IsOpen" type="client">
  Whether the menu is on screen right now.

  ```lua theme={"dark"}
  if exports['awoken_pausemenu']:IsOpen() then return end
  ```
</ParamField>

<ParamField path="RefreshPortrait" type="client">
  Throws away the cached headshot so the next open renders a new one. Call it after a clothing change, which is the one thing the cache cannot see: the ped and the model are both unchanged.

  ```lua theme={"dark"}
  exports['awoken_pausemenu']:RefreshPortrait()
  ```
</ParamField>

## Events

<ParamField path="awoken_pausemenu:visible" type="client event">
  Fires with `true` when the menu opens and `false` when it closes.

  ```lua theme={"dark"}
  AddEventHandler('awoken_pausemenu:visible', function(visible)
      exports['your_hud']:setVisible(not visible)
  end)
  ```
</ParamField>

<ParamField path="awoken_pausemenu:refreshPortrait" type="client event">
  The event form of `RefreshPortrait`, for a resource that would rather not reach for an export.
</ParamField>

## State bag

`LocalPlayer.state.pauseMenuOpen` is set for as long as the menu is up. This is the one to reach for in a resource you do not want to add a dependency to.

```lua theme={"dark"}
if LocalPlayer.state.pauseMenuOpen then return end
```

<Note>
  Most HUDs hide themselves when `IsPauseMenuActive()` is true. That never becomes true once this resource is running, because the native pause menu is exactly what it replaces. Swapping that check for the state bag above is usually a one line change.
</Note>

## Hooks

`client/hooks.lua` ships readable and is the place for anything that does not fit an export or an event. It survives updates in the sense that it is yours to edit, but replacing the folder overwrites it, so keep a copy.

```lua client/hooks.lua theme={"dark"}
function OnPauseMenuOpened()
    exports['your_emotes']:setEnabled(false)
end

function OnPauseMenuClosed()
    exports['your_emotes']:setEnabled(true)
end
```

## Keybinds from other resources

<Warning>
  A keybind registered with `RegisterKeyMapping` cannot be blocked by this resource, or by any resource. It bypasses the control system entirely, by design. The menu sidesteps it by taking the keyboard away from the game while it is open, which is why an inventory on a hotkey stays shut. That is also why there is no controller support: a pad can only be read while the game still has input, and keeping it would hand every other keybind back at the same time.
</Warning>

ox\_inventory is handled for you. The menu sets `LocalPlayer.state.invBusy`, which is what its own keybind checks before opening, and clears it again only if this menu was what set it.

## A framework we do not support

`server/adapters.lua` ships readable. Define a function there and it is asked before the bridge; return `nil` from one and the bridge answers instead, so you can override one answer and leave the rest alone.

```lua server/adapters.lua theme={"dark"}
function AwokenPauseAdapters.Balance(src, account)
    return MyFramework.GetWallet(src)[account]
end
```

The full list is in the file: `PlayerName`, `JobInfo`, `Balance` and `ItemCount`.
