SetSearchLightStartPosition

From Multi Theft Auto: Wiki
Revision as of 16:17, 11 December 2015 by AlexTMjugador (talk | contribs)
Jump to navigation Jump to search

This function sets the start position of a searchlight element.

Syntax

searchlight setSearchLightStartPosition ( float startX, float startY, float startZ )

OOP Syntax Help! I don't understand this!

Method: SearchLight:setStartPosition(...)
Variable: .startPosition
Counterpart: getSearchLightStartPosition


Required Arguments

  • startX: the X coordinate where the searchlight light cone will start.
  • startY: the Y coordinate where the searchlight light cone will start.
  • startZ: the Z coordinate where the searchlight light cone will start.

Returns

If every argument is correct, this function returns true. If not, it will return false plus an error message.

Example

This example creates a searchlight that originates in the camera position and targets the center of the map.

local searchLight = createSearchLight(0, 0, 0, 0, 0, 0, 0, 10)

if searchLight then
    local function updateSearchLight()
        -- Set its start position to the camera position
        setSearchLightStartPosition(searchLight, getCameraMatrix())
    end
    addEventHandler("onClientPreRender", root, updateSearchLight)
end

See also