SetVehicleWindowOpen: Difference between revisions
Jump to navigation
Jump to search
m (→Example) |
m (fix version) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client function}} | {{Client function}} | ||
{{New feature/item|3. | {{New feature/item|3.0153|1.5.3|7405|This function sets the vehicle window state.}} | ||
== Syntax == | == Syntax == | ||
Line 21: | Line 21: | ||
=== Returns === | === Returns === | ||
* | * when the vehicle is not streamed in: | ||
* | ** if the window ID does lie within the acceptable list of values, it will return '''true''' | ||
** if the window ID does ''not'' lie within the acceptable list of values, it will return '''false''' | |||
* when the vehicle is streamed in: | |||
** if the vehicle has the window, it will return '''true''' | |||
** if the vehicle does not have the window, it will return '''false''' | |||
== Example == | == Example == | ||
Line 42: | Line 46: | ||
outputChatBox( "Window switched!" ) | outputChatBox( "Window switched!" ) | ||
else | else | ||
outputChatBox( "You don't have window!") | outputChatBox( "You don't have window!" ) | ||
end | end | ||
else | else |
Latest revision as of 17:14, 22 October 2016
This function sets the vehicle window state.
Syntax
bool setVehicleWindowOpen ( vehicle theVehicle, int window, bool open )
Required arguments
- theVehicle: The vehicle that you wish to change the window state.
- window: An integer representing window.
- 0: motorbike shield
- 1: rear window
- 2: right front window
- 3: right back window
- 4: left front (driver) window
- 5: left back window
- 6: windshield
- open: Boolean which represent window open state.
Returns
- when the vehicle is not streamed in:
- if the window ID does lie within the acceptable list of values, it will return true
- if the window ID does not lie within the acceptable list of values, it will return false
- when the vehicle is streamed in:
- if the vehicle has the window, it will return true
- if the vehicle does not have the window, it will return false
Example
Command which allow player to open window which near sits.
local seatWindows = { [0] = 4, [1] = 2, [2] = 5, [3] = 3 } addCommandHandler("window", function() local veh = getPedOccupiedVehicle( localPlayer ) if veh then local seat = getPedOccupiedVehicleSeat( localPlayer ) if seatWindows[seat] and setVehicleWindowOpen( veh, seatWindows[seat], not isVehicleWindowOpen( veh, seatWindows[seat] ) ) then outputChatBox( "Window switched!" ) else outputChatBox( "You don't have window!" ) end else outputChatBox( "You must be in vehicle!" ) end end )
See also
- areVehicleLightsOn
- getHeliBladeCollisionsEnabled
- getHelicopterRotorSpeed
- getVehicleAdjustableProperty
- getVehicleComponentPosition
- getVehicleComponentRotation
- getVehicleComponents
- getVehicleComponentScale
- getVehicleComponentVisible
- getVehicleCurrentGear
- getVehicleDummyPosition
- getVehicleGravity
- getVehicleLandingGearDown
- getVehicleModelDummyDefaultPosition
- getVehicleModelDummyPosition
- getVehicleModelExhaustFumesPosition
- getVehicleModelWheelSize
- getVehicleNitroCount
- getVehicleNitroLevel
- getVehicleWheelFrictionState
- getVehicleWheelScale
- isTrainChainEngine
- isVehicleNitroActivated
- isVehicleNitroRecharging
- isVehicleOnGround
- isVehicleWheelOnGround
- isVehicleWindowOpen
- resetVehicleComponentPosition
- resetVehicleComponentRotation
- resetVehicleComponentScale
- resetVehicleDummyPositions
- setHeliBladeCollisionsEnabled
- setHelicopterRotorSpeed
- setVehicleAdjustableProperty
- setVehicleComponentPosition
- setVehicleComponentRotation
- setVehicleComponentScale
- setVehicleComponentVisible
- setVehicleDummyPosition
- setVehicleGravity
- setVehicleLandingGearDown
- setVehicleModelDummyPosition
- setVehicleModelExhaustFumesPosition
- setVehicleModelWheelSize
- setVehicleNitroActivated
- setVehicleNitroCount
- setVehicleNitroLevel
- setVehicleWheelScale
- setVehicleWheelStates
- setVehicleWindowOpen
- Shared
- 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