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

Function

setVehicleLampState

ServerVehiclesTrilogy Hub only

Turns one lamp (or a group of lamps) of a vehicle on, off or back to game control, for every player. This lets a script e.g. light the brake lamps when braking, the reverse lamps, or leave a single headlight working. The 'auto' state means the lamp works as usual in the game. An indicator set to 'on' shines steadily; blinking comes from setVehicleIndicators. Game cars have no reverse lamps or separate indicators (the front shines orange, the rear uses the red lens); custom models from engineReplaceModel have all lamps.

Syntax

bool setVehicleLampState(vehicle vehicle, string/int lamp [, string/bool state = 'auto'])

Arguments

vehiclevehicle
The vehicle.
lampstring/int
Lamp name: front_left, front_right, rear_left, rear_right, brake_left, brake_right, reverse_left, reverse_right, indicator_front_left, indicator_front_right, indicator_rear_left, indicator_rear_right; group: front, rear, brake, reverse, indicators, indicator_left, indicator_right, left, right, all; or a number 0-11 in this order.
statestring/bool, optional = 'auto'
'on'/true = lit, 'off'/false = off, 'auto'/nil = as in the game.

Returns

true on success, false for a bad name or state.

Example

addCommandHandler("cofanie", function(player)
    local vehicle = getPedOccupiedVehicle(player)
    if vehicle then setVehicleLampState(vehicle, "reverse", "on") end
end)

See also