# exports events

Full reference of all client events, server events, and NUI callbacks used by moh-boombox.

## Client Events (Server → Client)

| Event                       | Target        | Description                                                                     |
| --------------------------- | ------------- | ------------------------------------------------------------------------------- |
| `moh-boombox:useBoombox`    | Single player | Spawns the boombox prop on the player and starts the placement flow             |
| `moh-boombox:soundStatus`   | All clients   | Relays play / stop / volume / distance commands to all clients for synced audio |
| `moh-boombox:syncActive`    | All clients   | Broadcasts the current active radio table so all clients stay in sync           |
| `moh-boombox:deleteObj`     | All clients   | Deletes a boombox entity by network ID across all clients                       |
| `moh-boombox:stopAllSounds` | All clients   | Stops all boombox sounds and resets state on every client (admin command)       |
| `moh-boombox:notify`        | Single player | Sends a notification to a specific player                                       |

## Target Events (Target → Client)

| Event                  | Description                                                                                        |
| ---------------------- | -------------------------------------------------------------------------------------------------- |
| `moh-boombox:interact` | Fired when a player selects "Interact" on a placed boombox — opens the NUI panel                   |
| `moh-boombox:pickup`   | Fired when a player selects "Pick Up" on a placed boombox — runs pickup animation and returns item |

## Server Events (Client → Server)

| Event                      | Payload               | Description                                                               |
| -------------------------- | --------------------- | ------------------------------------------------------------------------- |
| `moh-boombox:soundStatus`  | `type, musicId, data` | Relays audio commands (play/stop/volume/distance) to all clients          |
| `moh-boombox:syncActive`   | `activeRadios`        | Syncs the active radio table to all connected clients                     |
| `moh-boombox:deleteObj`    | `netId`               | Broadcasts entity deletion to all clients                                 |
| `moh-boombox:objDeleted`   | —                     | Triggered after pickup animation — returns the boombox item to the player |
| `moh-boombox:save`         | `name, link`          | Inserts a new saved song row into the database for the current player     |
| `moh-boombox:deleteSong`   | `{ label, link }`     | Deletes a saved song from the database for the current player             |
| `moh-boombox:DiscordKnows` | `link`                | Sends a Discord webhook embed with player name and song URL               |

## NUI Callbacks

| Callback         | Payload                     | Description                                                    |
| ---------------- | --------------------------- | -------------------------------------------------------------- |
| `closeUI`        | —                           | Closes the NUI, releases focus, resets current radio reference |
| `playMusic`      | `{ url, volume, distance }` | Triggers audio playback via server relay to all clients        |
| `stopMusic`      | —                           | Stops the current track via server relay                       |
| `updateVolume`   | `{ volume }`                | Updates volume on the active sound (0.0–1.0 internally)        |
| `updateDistance` | `{ distance }`              | Updates the 3D sound max distance (1–40)                       |
| `saveSong`       | `{ name, url }`             | Saves a song label + URL to the database via server event      |
| `deleteSong`     | `{ label, link }`           | Removes a saved song from the database via server event        |

## NUI Messages (Server → NUI)

| Action             | Payload             | Description                                           |
| ------------------ | ------------------- | ----------------------------------------------------- |
| `openUI`           | `{ radioId }`       | Shows the panel and stores the active radio entity ID |
| `closeUI`          | —                   | Hides the panel                                       |
| `updateSavedSongs` | `{ songs: [] }`     | Populates the saved songs chip list                   |
| `updateStatus`     | `{ playing, song }` | Updates the vinyl state and song name display         |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mohssins.gitbook.io/mohscriptsdocs/moh-boombox/exports-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
