setVehicleOverrideLights
Shared
Forces a vehicle's lights on or off, or hands the choice back to the game.
bool setVehicleOverrideLights(element vehicle, int lights)
Parameters
| Name | Type | Description |
|---|---|---|
| vehicle | element | The vehicle, or a parent element whose vehicles all change. |
| lights | int | 0 the game decides, 1 always off, 2 always on. |
Returns
true if it changed. false if the value is out of range or was already set.
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
addCommandHandler("farois", function(player)
local vehicle = getPedOccupiedVehicle(player)
if not vehicle then return end
if getVehicleOverrideLights(vehicle) == 2 then
setVehicleOverrideLights(vehicle, 1)
else
setVehicleOverrideLights(vehicle, 2)
end
end)