IsVehicleTaxiLightOn: Difference between revisions
Jump to navigation
Jump to search
Cazomino05 (talk | contribs) (New page: __NOTOC__ Category:Needs_Example {{Server client function}} This function will get the taxi light state of a taxi (vehicle ID's 420 and 438) ==Syntax== <syntaxhighlight lang="lua"> bool isVehicleT...) |
|||
Line 16: | Line 16: | ||
==Example== | ==Example== | ||
<section name="Client" class="client" show="true"> | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | function myfunction() | ||
local player = getLocalPlayer() | |||
local vehicle = getPlayerOccupiedVehicle(player) | |||
if player == getVehicleOccupant(vehicle, 0) then -- if is a driver | |||
local lights = getVehicleTaxiLightOn(getElementModel(vehicle)) -- getting vehicle model | |||
if ((vehicle == 420) or (vehicle == 438) then -- if is a taxi | |||
setVehicleTaxiLightOn(vehicle, not lights) -- switch lights | |||
end | |||
end | |||
end | |||
bind("o", "down", myfunction) -- binding the function | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{vehicle functions}} | {{vehicle functions}} |
Revision as of 12:40, 30 November 2009
This function will get the taxi light state of a taxi (vehicle ID's 420 and 438)
Syntax
bool isVehicleTaxiLightOn ( vehicle taxi )
Required Arguments
- taxi: The vehicle element of the taxi that you wish to get the light state of.
Returns
Returns true if the light is on, false otherwise.
Example
Click to collapse [-]
Clientfunction myfunction() local player = getLocalPlayer() local vehicle = getPlayerOccupiedVehicle(player) if player == getVehicleOccupant(vehicle, 0) then -- if is a driver local lights = getVehicleTaxiLightOn(getElementModel(vehicle)) -- getting vehicle model if ((vehicle == 420) or (vehicle == 438) then -- if is a taxi setVehicleTaxiLightOn(vehicle, not lights) -- switch lights end end end bind("o", "down", myfunction) -- binding the function
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