IsVehicleWindowOpen: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (fix versiuon) |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client function}} | {{Client function}} | ||
{{New feature/item|3.0153|1.5.3|7405|This function gets the vehicle window state.}} | |||
{{New feature/item|3. | |||
== Syntax == | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool isVehicleWindowOpen ( vehicle theVehicle, int window ) | bool isVehicleWindowOpen ( vehicle theVehicle, int window ) | ||
Line 10: | Line 9: | ||
=== Required arguments === | === Required arguments === | ||
* '''theVehicle:''' The vehicle that you wish to | * '''theVehicle:''' The vehicle that you wish to get the window state. | ||
* '''window:''' An integer representing window. | * '''window:''' An [[int|integer]] representing a vehicle window. It can be: | ||
** '''0:''' motorbike shield | ** '''0:''' motorbike shield | ||
** '''1:''' rear window | ** '''1:''' rear window | ||
Line 20: | Line 19: | ||
** '''6:''' windshield | ** '''6:''' windshield | ||
== Returns == | |||
This function returns a boolean which represents window open state | This function returns a boolean which represents window open state. | ||
== Example == | == Example == | ||
<syntaxhighlight lang="lua"> | This example opens the vehicle windows when the local player use /openwindow <window number>. | ||
<syntaxhighlight lang="lua">function openVehicleWindow (cmd,number) | |||
if (isPedInVehicle (localPlayer)) then | |||
local vehicle = getPedOccupiedVehicle(localPlayer) | |||
if number and tonumber(number) then | |||
if tonumber(number) > 0 and tonumber(number) < 7 then | |||
setVehicleWindowOpen(vehicle,tonumber(number), not isVehicleWindowOpen( vehicle, tonumber(number))) | |||
end | |||
end | |||
end | |||
end | |||
addCommandHandler ("openwindow",openVehicleWindow)</syntaxhighlight> | |||
== See also == | == See also == | ||
{{Client vehicle functions}} | {{Client vehicle functions}} |
Latest revision as of 17:15, 22 October 2016
This function gets the vehicle window state.
Syntax
bool isVehicleWindowOpen ( vehicle theVehicle, int window )
Required arguments
- theVehicle: The vehicle that you wish to get the window state.
- window: An integer representing a vehicle window. It can be:
- 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
Returns
This function returns a boolean which represents window open state.
Example
This example opens the vehicle windows when the local player use /openwindow <window number>.
function openVehicleWindow (cmd,number) if (isPedInVehicle (localPlayer)) then local vehicle = getPedOccupiedVehicle(localPlayer) if number and tonumber(number) then if tonumber(number) > 0 and tonumber(number) < 7 then setVehicleWindowOpen(vehicle,tonumber(number), not isVehicleWindowOpen( vehicle, tonumber(number))) end end end end addCommandHandler ("openwindow",openVehicleWindow)
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