# setCinematicCaptions (Client)

> Sets the captions the cinematic draws on screen during playback. It replaces the earlier captions.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Cinematics
- **URL**: https://wiki.mymp.gg/en/setCinematicCaptions

## Syntax

```lua
bool setCinematicCaptions(cinematic cinematic, table captions)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `cinematic` | `cinematic` | The cinematic. |
| `captions` | `table` | A list of captions, in order of `time`. |

## Returns

`true` if they were applied. `false` if the table is invalid, with a warning saying why.

Sizes and distances are pixels on a 1080-line screen. Each caption has:

- `time`: when it appears, in cinematic ms (required).
- `length`: how long it lasts, in ms, above 0 (required).
- `text`: the text (required).
- `font`: the path of a `.ttf` in a resource (required).
- `size`: from 4 to 400, 36 by default.
- `anchor`: `"top-left"`, `"top"`, `"top-right"`, `"left"`, `"center"`, `"right"`, `"bottom-left"`, `"bottom"` (default) or `"bottom-right"`.
- `align`: `"left"`, `"center"` (default) or `"right"`.
- `offsetX` and `offsetY`: the offset from the anchor.
- `red`, `green` and `blue`: from 0 to 255, white by default. `opacity`: from 0 to 1, 1 by default.
- `fadeIn` and `fadeOut`: fade ms.
- `slideIn` and `slideOut`: `"none"` (default), `"left"`, `"right"`, `"top"` or `"bottom"`. `slideDistance`: how far it slides, 60 by default.
- `typing`: ms per character to type the text in. `0` shows it all at once.

## Example

```lua
local intro = createCinematic("cinematics/intro.cine")
setCinematicCaptions(intro, {
    { time = 500, length = 4000, text = "Los Santos, 1992", font = "fonts/title.ttf", size = 48, anchor = "top", offsetY = 80, fadeIn = 500, fadeOut = 500 },
    { time = 3000, length = 2500, text = "Where is everybody?", font = "fonts/subs.ttf", typing = 40 },
})
```

## See also

- [getCinematicCaptions (Client)](https://wiki.mymp.gg/en/getCinematicCaptions.md): Returns the cinematic's captions.
- [setCinematicAudio (Client)](https://wiki.mymp.gg/en/setCinematicAudio.md): Sets the sounds the cinematic plays during playback. It replaces the earlier sounds.
- [dxCreateFont (Client)](https://wiki.mymp.gg/en/dxCreateFont.md): Creates a font from a font file in the resource, for the text functions.
