setVehicleOverrideLights | Multi Theft Auto: Wiki Skip to content

setVehicleOverrideLights

Client-side
Server-side
Shared

Pair: getVehicleOverrideLights

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function changes the light overriding setting on a vehicle.

Syntax

setVehicleOverrideLights ( )

Code Examples

server

This example will toggle the car lights on and off for a player's vehicle by using a "vehiclelights" command.

function consoleVehicleLights ( source )
if isPedInVehicle(source) then -- checks is the player in vehicle if yes, then:
playerVehicle = getPedOccupiedVehicle ( source ) -- get the player's vehicle
if ( playerVehicle ) then -- if he was in one
if ( getVehicleOverrideLights ( playerVehicle ) ~= 2 ) then -- if the current state isn't 'force on'
setVehicleOverrideLights ( playerVehicle, 2 ) -- force the lights on
else
setVehicleOverrideLights ( playerVehicle, 1 ) -- otherwise, force the lights off
end
end
end
end
addCommandHandler ( "vehiclelights", consoleVehicleLights )

See Also

Vehicle Functions