Skip to content

SetPlayerCamera

Puts the player’s view at a point, looking at another - a cutscene, a view over a town.

The player’s view moves to x y z and looks at lx ly lz, gliding there from where it is over ms milliseconds (0 = a cut, at most 60000; the glide eases in and out), with the field of view fov - a narrow one zooms in. Their body stays where it is, its head shown, and their keys still move it - hold them with TogglePlayerControllable for a cutscene. The view stays there until ResetPlayerCamera, through a death or a respawn; a rejoin starts with their own view. Several calls in a row make a camera tour: each glides on from where the last one is.

SetPlayerCamera(pid, x, y, z, lx, ly, lz [, ms, fov])
Parameter Type
pid number the player
x number metres - where the camera stands
y number metres
z number metres
lx number metres - the point it looks at
ly number metres
lz number metres
ms number the glide from where the view is, milliseconds (0 = a cut) (optional)
fov number the field of view in degrees, 10-120 (nil = the player’s own) (optional)

boolean - false when not connected, or when the point looks nowhere (it is the camera’s own)

-- the house for sale, from across the street and zoomed in, then the player's own view again
TogglePlayerControllable(pid, false)
SetPlayerCamera(pid, 1302.0, 1080.0, 31.0, 1310.5, 1092.0, 28.0, 2000, 40)
SetTimer(function()
ResetPlayerCamera(pid, 1500)
TogglePlayerControllable(pid, true)
end, 6000)

ResetPlayerCamera · IsPlayerCameraSet · TogglePlayerControllable · the Players group of the index