> For the complete documentation index, see [llms.txt](https://docs.oakwood-mp.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.oakwood-mp.net/public-api/chat.md).

# Chat

This page describes chat API methods

## Send message

`chatSend(player, string)`

Send message to player.

{% tabs %}
{% tab title="Details" %}

### Remarks

### Arguments

| Type   | Description |
| ------ | ----------- |
| player | Player ID   |
| string | Message     |

### Returns

0 if successful, -1 if invalid
{% endtab %}

{% tab title="Example" %}

```javascript
oak.cmd('testmsg', async(pid) => {
    oak.chatSend(pid, 'Testovací zpráva')
})
```

{% endtab %}
{% endtabs %}

## Broadcast message

`chatBroadcast(string)`

Broadcast message to players.

{% tabs %}
{% tab title="Details" %}

### Remarks

### Arguments

| Type   | Description |
| ------ | ----------- |
| string | Message     |

### Returns

0 if successful, -1 if invalid
{% endtab %}

{% tab title="Example" %}

```javascript
// TODO
```

{% endtab %}
{% endtabs %}
