SetVehicleTaxiLightOn: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Dutchman101 (talk | contribs) (Replaced code example with something less messy) |
||
Line 16: | Line 16: | ||
==Example== | ==Example== | ||
This example | This example allows the driver of a taxi to toggle on/off taxi light with a command | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function toggleTaxiLight() | |||
local vehicle = getPedOccupiedVehicle(localPlayer) | |||
if vehicle and getVehicleController(vehicle) == localPlayer then | |||
local vehModel = getElementModel(vehicle) | |||
if (vehModel) == 420 or (vehModel) == 438 then | |||
setVehicleTaxiLightOn (vehicle, not isVehicleTaxiLightOn(vehicle)) | |||
else | |||
outputChatBox ("You're not in a Taxi!", 255, 0, 0, true) | |||
end | |||
end | |||
end | |||
addCommandHandler("taxilight",toggleTaxiLight) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{vehicle functions}} | {{vehicle functions}} |
Latest revision as of 02:25, 1 August 2018
This function will set the taxi light on in a taxi (vehicle ID's 420 and 438)
Syntax
bool setVehicleTaxiLightOn ( vehicle taxi, bool LightState )
OOP Syntax Help! I don't understand this!
- Method: vehicle:setTaxiLightOn(...)
- Variable: .taxiLightOn
- Counterpart: isVehicleTaxiLightOn
Required Arguments
- taxi: The vehicle element of the taxi that you wish to turn the light on.
- LightState: whether the light is on. True for on, False for off.
Returns
Returns true if the state was successfully set, false otherwise.
Example
This example allows the driver of a taxi to toggle on/off taxi light with a command
function toggleTaxiLight() local vehicle = getPedOccupiedVehicle(localPlayer) if vehicle and getVehicleController(vehicle) == localPlayer then local vehModel = getElementModel(vehicle) if (vehModel) == 420 or (vehModel) == 438 then setVehicleTaxiLightOn (vehicle, not isVehicleTaxiLightOn(vehicle)) else outputChatBox ("You're not in a Taxi!", 255, 0, 0, true) end end end addCommandHandler("taxilight",toggleTaxiLight)
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