ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. shakeCamera

Function

shakeCamera

ClientCameraIdentical to MTA:SA

Shakes the camera for a moment, e.g. on an explosion. Strength 0-255.

Syntax

bool shakeCamera(float strength [, float x = 0, float y = 0, float z = 0])

Arguments

strengthfloat
Strength 0-255.
xfloat, optional = 0
Source X (for compatibility with existing scripts).
yfloat, optional = 0
Source Y.
zfloat, optional = 0
Source Z.

Returns

true on success.

Example

addEventHandler("onClientExplosion", root, function(x, y, z)
    local px, py, pz = getElementPosition(localPlayer)
    local d = getDistanceBetweenPoints3D(x, y, z, px, py, pz)
    if d < 30 then
        shakeCamera(255 * (1 - d / 30))
    end
end)

See also