SetVehicleOverrideLights: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This function changes the overriding | {{Server client function}} | ||
This function changes the light overriding setting on a vehicle, possible values are: 0 (No override), 1 (Force off), 2 (Force on) | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">bool setVehicleOverrideLights ( vehicle theVehicle, int | <syntaxhighlight lang="lua">bool setVehicleOverrideLights ( vehicle theVehicle, int value )</syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theVehicle''': The [[vehicle]] you wish to change the override lights setting of. | *'''theVehicle''': The [[vehicle]] you wish to change the override lights setting of. | ||
*''' | *'''value''': A whole number representing 1 of the 3 settings (0,1,2) | ||
==Returns== | ==Returns== | ||
Returns 'true' if the vehicle's lights | Returns ''true'' if the vehicle's lights setting was changed. Otherwise ''false''. | ||
==Example== | ==Example== | ||
This example will toggle the car lights on and off for a player's vehicle | This example will toggle the car lights on and off for a player's vehicle | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function vehicleLights ( source ) | function vehicleLights ( source ) | ||
playervehicle = getPlayerOccupiedVehicle ( 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 | end | ||
addCommandHandler ( "vehiclelights", vehicleLights ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Vehicle functions}} | {{Vehicle functions}} |
Revision as of 20:00, 15 August 2007
This function changes the light overriding setting on a vehicle, possible values are: 0 (No override), 1 (Force off), 2 (Force on)
Syntax
bool setVehicleOverrideLights ( vehicle theVehicle, int value )
Required Arguments
- theVehicle: The vehicle you wish to change the override lights setting of.
- value: A whole number representing 1 of the 3 settings (0,1,2)
Returns
Returns true if the vehicle's lights setting was changed. Otherwise false.
Example
This example will toggle the car lights on and off for a player's vehicle
function vehicleLights ( source ) playervehicle = getPlayerOccupiedVehicle ( 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 addCommandHandler ( "vehiclelights", vehicleLights )
See Also
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates