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

Function

setVehicleOverrideLights

Server and clientVehiclesIdentical to MTA:SA

Forces the state of a vehicle's lights for every player. In Trilogy Hub the game does not switch the lights on at dusk by itself, so the headlights only shine after setting 2. Single lamps (brake, reverse, indicators) are set with setVehicleLampState.

Syntax

bool setVehicleOverrideLights(vehicle vehicle, int state)

Arguments

vehiclevehicle
The vehicle.
stateint
0 = no override (lights off), 1 = always off, 2 = always on.

Returns

true on success, false for a value outside 0-2.

Example

addCommandHandler("swiatla", function(player)
    local vehicle = getPedOccupiedVehicle(player)
    if vehicle and getVehicleController(vehicle) == player then
        setVehicleOverrideLights(vehicle, getVehicleOverrideLights(vehicle) == 2 and 1 or 2)
    end
end)

Notes

Client. In a client script the lights apply for this player only, until the server sets them for this vehicle.

See also