> For the complete documentation index, see [llms.txt](https://dtrx-studio.gitbook.io/dtrx-studio-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dtrx-studio.gitbook.io/dtrx-studio-docs/fivem-products/dtrx-chat/events/server-events.md).

# Server Events

| Event                          | Arguments                                        | Description                                  |
| ------------------------------ | ------------------------------------------------ | -------------------------------------------- |
| `dtrx_chat:server:sendMessage` | `channelKey`, `content`, optional audio/location | Client → server send (normally used by NUI). |
| `dtrx_chat:server:broadcast`   | `channelKey`, `content`, `meta?`                 | Fired by `ChatAPI.Broadcast` export.         |
| `dtrx_chat:server:sendTo`      | `source`, `channelKey`, `content`, `meta?`       | Fired by `ChatAPI.SendTo` export.            |
| `dtrx_chat:server:pm`          | `targetId`, `targetCid`, `content`, …            | Private message pipeline.                    |

### (Broadcast / SendTo)

Optional fields on server broadcasts:

| Field        | Type     | Description                                      |
| ------------ | -------- | ------------------------------------------------ |
| `senderId`   | `number` | Display sender server id (default `0` = system). |
| `senderName` | `string` | Display name (default `SYSTEM`).                 |
| `senderCid`  | `string` | Character id string (default `system`).          |
| `targetId`   | `number` | Optional target hint for UI styling.             |

Example:

```lua
exports['dtrx_chat']:Broadcast('all', 'Server restart in 10 minutes.', {
    senderName = 'City Hall',
    senderId = 0,
})
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://dtrx-studio.gitbook.io/dtrx-studio-docs/fivem-products/dtrx-chat/events/server-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.
