M MY Multiplayer: Wiki
Side
Kind

setCinematicCaptions

Client

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

bool setCinematicCaptions(cinematic cinematic, table captions)

Parameters

NameTypeDescription
cinematiccinematicThe cinematic.
captionstableA 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

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