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

# Client

Client exports and events of Striga Chat.

## Exports

| Export                              | What it does                      |
| ----------------------------------- | --------------------------------- |
| `addMessage(message)`               | Adds a line to this player's chat |
| `addSuggestion(name, help, params)` | Adds help for a command           |

```lua
exports.chat:addMessage({ args = { 'System', 'Vehicle locked' } })

exports.chat:addSuggestion('/repair', 'Repair your vehicle', {
    { name = 'id', help = 'Vehicle id' },
})
```

## Events

| Event                   | Arguments             | What it does                  |
| ----------------------- | --------------------- | ----------------------------- |
| `chat:addMessage`       | `message`             | Adds a line                   |
| `chatMessage`           | `author, color, text` | Old style message             |
| `chat:addSuggestion`    | `name, help, params`  | Adds help for one command     |
| `chat:addSuggestions`   | `list`                | Adds help for many commands   |
| `chat:removeSuggestion` | `name`                | Removes the help of a command |
| `chat:addTemplate`      | `id, html`            | Adds an HTML template         |
| `chat:clear`            | -                     | Clears the chat               |
| `chat:addMode`          | `mode`                | Adds a mode                   |
| `chat:removeMode`       | `mode`                | Removes a mode                |

All of them can be sent from the server with `TriggerClientEvent(event, target, ...)` or on the client with `TriggerEvent`.

```lua
-- server
TriggerClientEvent('chat:addMessage', source, {
    color = { 56, 189, 248 },
    args = { 'Dispatch', 'Shots fired near Legion Square' },
})

TriggerClientEvent('chat:addSuggestion', -1, '/repair', 'Repair your vehicle')
TriggerClientEvent('chat:clear', source)
```

***

## For HUD and layout scripts

These exports are for scripts that want to move or color the chat, like a HUD editor.

| Export                   | What it does                                                                                                  |
| ------------------------ | ------------------------------------------------------------------------------------------------------------- |
| `SetPreview(true/false)` | Shows a still copy of the chat while your editor is open. Turned off by itself when your resource stops       |
| `SetLayout(settings)`    | Changes the player's chat settings (saved for that player). Returns `false` when `Config.Ui.Settings = false` |
| `GetFrame()`             | Returns the last chat box (`x`, `y`, `w`, `h` in screen %, plus settings)                                     |
| `SetTheme(color)`        | Sets the theme color, e.g. `'#3b82f6'`. `nil` removes it. Removed by itself when your resource stops          |

```lua
exports['striga-chat']:SetPreview(true)

exports['striga-chat']:SetLayout({
    x = 2, y = 60,          -- screen %, false = back to the config spot
    accent = '#22d3ee',     -- player color, false = follow the HUD / config again
    width = 110,            -- 70 to 160
    textScale = 100,        -- 80 to 140
    height = 100,           -- 50 to 200
    radius = 10,            -- 0 to 20
    opacity = 80,           -- 30 to 100
    blur = 8,               -- 0 to 16
    style = 'tinted',       -- card / tinted / compact
    timestamps = true,
    inputTag = false,
})

exports['striga-chat']:SetLayout({ reset = true }) -- back to config defaults

local frame = exports['striga-chat']:GetFrame()
```

### striga-chat:client:frame

Client event. Fires when the chat box changes, with the same table as `GetFrame()`.

```lua
AddEventHandler('striga-chat:client:frame', function(frame)
    print(frame.x, frame.y, frame.w, frame.h)
end)
```

{% hint style="info" %}
The theme color comes from the striga-core theme bus (`striga-core:client:theme`), and the `/hud` menu edits the chat settings through the striga-core settings hub. `SetTheme` stays for HUDs that call the chat directly. See [Settings Hub & Theme](/docs/striga-core/settings-hub-and-theme.md).
{% endhint %}

{% content-ref url="/pages/yBebLpu33ZdycoXwtUDw" %}
[Server](/docs/striga-chat/exports-and-events/server.md)
{% endcontent-ref %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://striga.gitbook.io/docs/striga-chat/exports-and-events/client.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
