GetVehicleWheelStates: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 18: | Line 18: | ||
==Example== | ==Example== | ||
This example creates a new vehicle then gets the states of the vehicle's wheels. | This example creates a new vehicle then gets the states of the vehicle's wheels. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
frontLeft, frontRight, rearLeft, rearRight = | function scriptWheelStates ( player, command ) | ||
outputChatBox ( " | local theVehicle = getPlayerOccupiedVehicle ( player ) | ||
if ( theVehicle ) then | |||
local states = { [0]="inflated", [1]="flat", [2]="fallen off" } | |||
frontLeft, frontRight, rearLeft, rearRight = getVehicleWheelStates ( theVehicle ) | |||
outputChatBox ( "Wheel states:" ) | |||
outputChatBox ( "Front-Left: " .. states [ frontLeft ] .. ", Front-Right: " .. states [ frontRight ] | |||
.. ", Rear-Left: " .. states [ rearLeft ] .. ", Rear-Right: " .. states [ rearRight ] ) | |||
else outputChatBox ( "You have to be in a vehicle to use this command." ) | |||
end | |||
end | |||
addCommandHandler ( "wheelstates", scriptWheelStates )</syntaxhighlight> | |||
==See Also== | ==See Also== | ||
{{Vehicle functions}} | {{Vehicle functions}} |
Revision as of 08:41, 31 July 2007
This function returns the current states of all the wheels on the vehicle.
No vehicles have more than 4 wheels, if they appear to they will be duplicating other wheels.
Syntax
int, int, int, int getVehicleWheelStates ( vehicle theVehicle )
Required Arguments
- theVehicle: A handle to the vehicle that you wish to know the wheel states of.
Returns
Returns 4 ints indicating the states of the wheel. These values can be:
- 0: Inflated
- 1: Flat
- 2: Fallen off
Example
This example creates a new vehicle then gets the states of the vehicle's wheels.
function scriptWheelStates ( player, command ) local theVehicle = getPlayerOccupiedVehicle ( player ) if ( theVehicle ) then local states = { [0]="inflated", [1]="flat", [2]="fallen off" } frontLeft, frontRight, rearLeft, rearRight = getVehicleWheelStates ( theVehicle ) outputChatBox ( "Wheel states:" ) outputChatBox ( "Front-Left: " .. states [ frontLeft ] .. ", Front-Right: " .. states [ frontRight ] .. ", Rear-Left: " .. states [ rearLeft ] .. ", Rear-Right: " .. states [ rearRight ] ) else outputChatBox ( "You have to be in a vehicle to use this command." ) end end addCommandHandler ( "wheelstates", scriptWheelStates )
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