SetVehicleOverrideLights
From Multi Theft Auto: Wiki
This function changes the light overriding setting on a vehicle.
Syntax
bool setVehicleOverrideLights ( vehicle theVehicle, int value )
OOP Syntax Help! I don't understand this!
- Method: vehicle:setOverrideLights(...)
- Variable: .overrideLights
- Counterpart: getVehicleOverrideLights
Required Arguments
- theVehicle: The vehicle you wish to change the override lights setting of.
- value: A whole number representing the state of the lights:
- 0: No override, lights are set to default.
- 1: Lights are forced off.
- 2: Lights are forced on.
Returns
Returns true if the vehicle's lights setting was changed. Otherwise false.
Example
Click to collapse [-]
Example 1This 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 )
Click to collapse [-]
Example 2This example will toggle the car lights on and off for a player's vehicle by using a "vehiclelights" command.
function consoleVehicleLights () if isPedInVehicle(getLocalPlayer()) then -- checks is the player in vehicle if yes, then: playerVehicle = getPedOccupiedVehicle ( getLocalPlayer() ) -- get the local 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
FROM VERSION 1.5.7 r19626 ONWARDS
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getModelHandling
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
FROM VERSION 1.6 r7485 ONWARDS
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleRespawnPosition
- getVehicleRespawnRotation
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- getVehiclesOfType
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleSirens
- removeVehicleUpgrade
- resetVehicleExplosionTime
- resetVehicleIdleTime
- respawnVehicle
- setModelHandling
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
FROM VERSION 1.6 r7485 ONWARDS
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleIdleRespawnDelay
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleRespawnDelay
- setVehicleRespawnPosition
- setVehicleRespawnRotation
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition