SetVehicleTaxiLightOn: Difference between revisions
Jump to navigation
Jump to search
Cazomino05 (talk | contribs) No edit summary |
No edit summary |
||
Line 18: | Line 18: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | addEventHandler ( "onPlayerJoin" , getRootElement ( ) , | ||
function ( ) | |||
bindKey ( source , "o", "down", | |||
function ( thePlayer ) | |||
if ( isPedInVehicle ( thePlayer ) ) then --is in vehicle or not? | |||
local vehicle = getPedOccupiedVehicle ( thePlayer ) --getting player's occupied vehicle | |||
if ( getVehicleController ( vehicle ) == thePlayer ) then --is driver or not? | |||
local id = getElementModel ( vehicle ) --getting vehicle's model | |||
if ( ( id == 420 ) or ( id == 438 ) ) then --is a taxi? | |||
setVehicleTaxiLightOn ( vehicle, not isVehicleTaxiLightOn ( vehicle ) ) --changing taxi light on/off | |||
end | |||
end | |||
end | |||
end) | |||
end ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{vehicle functions}} | {{vehicle functions}} |
Revision as of 19:12, 30 August 2009
This function will set the taxi light on in a taxi (vehicle ID's 420 and 438)
Syntax
bool setVehicleTaxiLightOn ( vehicle taxi, bool LightState )
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
addEventHandler ( "onPlayerJoin" , getRootElement ( ) , function ( ) bindKey ( source , "o", "down", function ( thePlayer ) if ( isPedInVehicle ( thePlayer ) ) then --is in vehicle or not? local vehicle = getPedOccupiedVehicle ( thePlayer ) --getting player's occupied vehicle if ( getVehicleController ( vehicle ) == thePlayer ) then --is driver or not? local id = getElementModel ( vehicle ) --getting vehicle's model if ( ( id == 420 ) or ( id == 438 ) ) then --is a taxi? setVehicleTaxiLightOn ( vehicle, not isVehicleTaxiLightOn ( vehicle ) ) --changing taxi light on/off end end end end) end )
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