getVehicleLightState
Shared
Returns whether one or more lights of a vehicle are broken.
int|table|false getVehicleLightState(vehicle vehicle, int|string|table light)
Parameters
| Name | Type | Description |
|---|---|---|
| vehicle | vehicle | The vehicle. |
| light | int|string|table | Which light: its number (0 front left, 1 front right, 2 rear right, 3 rear left), its frame name (headlight_l, headlight_r, taillight_r, taillight_l), a group (all, front_lights, rear_lights, left_lights, right_lights), -1 for all of them or a table of several. |
Returns
The state (0 working, 1 broken). When several lights were asked for (a group, -1 or a table), a table of frame name → value. false if the vehicle lacks one of the lights named.
Example
addCommandHandler("farol", function(player)
local vehicle = getPedOccupiedVehicle(player)
if vehicle and getVehicleLightState(vehicle, 0) == 1 then
setVehicleLightState(vehicle, 0, 0)
end
end)