# setVehicleLightState (Shared)

> Breaks or repairs one or more lights of a vehicle.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Vehicles
- **URL**: https://wiki.mymp.gg/en/setVehicleLightState

## Syntax

```lua
bool setVehicleLightState(element vehicle, int|string|table light, int state)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `vehicle` | `element` | The vehicle, or a parent element whose vehicles all change. |
| `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. |
| `state` | `int` | The new state: 0 working, 1 broken. |

## Returns

`true` if any light changed. `false` if the state is out of range or the vehicle lacks the light. On the server, also `false` when nothing changed.

Given a parent element such as `root`, it applies to every vehicle below it, but the value returned is the element's own: `false` when it is not a vehicle.

## Example

```lua
addCommandHandler("quebrarfarois", function(player)
    local vehicle = getPedOccupiedVehicle(player)
    if vehicle then
        setVehicleLightState(vehicle, "front_lights", 1)
    end
end)
```

## See also

- [getVehicleLightState (Shared)](https://wiki.mymp.gg/en/getVehicleLightState.md): Returns whether one or more lights of a vehicle are broken.
- [setVehicleOverrideLights (Shared)](https://wiki.mymp.gg/en/setVehicleOverrideLights.md): Forces a vehicle's lights on or off, or hands the choice back to the game.
- [fixVehicle (Shared)](https://wiki.mymp.gg/en/fixVehicle.md): Repairs a vehicle completely: its health goes back to 1000 and its doors, wheels and lights to their initial state, with no dents or bullet holes.
