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

Function

setCameraTarget

Server and clientCameraIdentical to MTA:SA

Puts the camera behind the player or makes it follow another element (e.g. when spectating).

Syntax

Server

bool setCameraTarget(player thePlayer [, element target = thePlayer])

Client

bool setCameraTarget(element target)

Arguments

thePlayerplayer
The player (server only).
targetelement, optional = gracz
The element to follow.

Returns

true on success.

Example

addCommandHandler("spec", function(player, cmd, name)
    local target = name and getPlayerFromName(name)
    setCameraTarget(player, target or player)
end)

See also