ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. createSearchLight

Function

createSearchLight

ServerLightsIdentical to MTA:SA

Creates a searchlight beam: a real Unreal spot light shining from a start point to an end point, like a police helicopter searchlight or stadium lights. The cone width comes from the end radius and the distance; brightness adjusts itself to the beam length. Everyone in the same interior and dimension sees it.

Syntax

element createSearchLight(float startX, float startY, float startZ, float endX, float endY, float endZ [, float startRadius = 1, float endRadius = 10, bool renderSpline = true])

Arguments

startXfloat
Source X.
startYfloat
Source Y.
startZfloat
Source Z.
endXfloat
X of the lit spot.
endYfloat
Spot Y.
endZfloat
Spot Z.
startRadiusfloat, optional = 1
Beam radius at the source (m).
endRadiusfloat, optional = 10
Radius of the light spot at the end (m).
renderSplinebool, optional = true
For compatibility with existing scripts.

Returns

A searchlight element, or false.

Example

local light = createSearchLight(2495, -1680, 40, 2495, -1665, 13, 1, 6)
setTimer(function()
    local player = getRandomPlayer()
    if player then
        local x, y, z = getElementPosition(player)
        setSearchLightEndPosition(light, x, y, z)
    end
end, 200, 0)

See also