ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. fadeCamera

Function

fadeCamera

Server and clientCameraIdentical to MTA:SA

Fades the screen out or in, in a given colour. Useful for teleports, joining and cutscenes.

Syntax

Server

bool fadeCamera(player thePlayer, bool fadeIn [, float timeToFade = 1.0, int r = 0, int g = 0, int b = 0])

Client

bool fadeCamera(bool fadeIn [, float timeToFade = 1.0, int r = 0, int g = 0, int b = 0])

Arguments

thePlayerplayer
The player (server only).
fadeInbool
true fades in, false fades out.
timeToFadefloat, optional = 1.0
Time in seconds.
rint, optional = 0
Red of the overlay.
gint, optional = 0
Green.
bint, optional = 0
Blue.

Returns

true on success.

Example

A teleport with a fade.

local function fadeTeleport(player, x, y, z)
    fadeCamera(player, false, 0.5)
    setTimer(function()
        setElementPosition(player, x, y, z)
        fadeCamera(player, true, 0.5)
    end, 600, 1)
end