GetVehicleWheelStates: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Needs Checking|the function doesn't work how it should, the order is FrontL, RearL, FrontR, RearR, when trying to pop out a tire and the ones before them (in the order I mentioned earlier) aren't flat it will remain unchanged, for instance I pop out the RealL tire the function will still say it's inflated but if I pop out the FrontL tire then it works, also it doesn't seem to work with bikes EDIT: it seems to be working well client side (except with bikes) --[[User:Norby89|Norby89]] 09:15, 5 August 2007 (CDT)}} | |||
{{Server client function}} | {{Server client function}} | ||
This function returns the current states of all the wheels on the vehicle. | This function returns the current states of all the wheels on the vehicle. |
Revision as of 14:15, 5 August 2007
This article needs checking. | |
Reason(s): the function doesn't work how it should, the order is FrontL, RearL, FrontR, RearR, when trying to pop out a tire and the ones before them (in the order I mentioned earlier) aren't flat it will remain unchanged, for instance I pop out the RealL tire the function will still say it's inflated but if I pop out the FrontL tire then it works, also it doesn't seem to work with bikes EDIT: it seems to be working well client side (except with bikes) --Norby89 09:15, 5 August 2007 (CDT) |
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
Click to collapse [-]
ServerThis example displays the states of the vehicle's wheels and changes their states if any arguments were passed.
function scriptWheelStates ( thePlayer, command, newFLeft, newRLeft, newFRight, newRRight ) local theVehicle = getPlayerOccupiedVehicle ( thePlayer ) if ( theVehicle ) then -- check if the player is in a car if ( newFLeft ) then -- if there's at least one argument passed, we change the wheel states if not setVehicleWheelStates ( theVehicle, newFLeft, newRLeft, newFRight, newRRight ) then outputChatBox ( "Bad arguments." ) end end local states = { [0]="inflated", [1]="flat", [2]="fallen off" } -- we store the states in a table local frontLeft, frontRight, rearLeft, rearRight = getVehicleWheelStates ( theVehicle ) outputChatBox ( "Your vehicle's wheel states:", thePlayer ) -- output them in the chatbox outputChatBox ( "Front-Left: " .. states [ frontLeft ] .. ", Front-Right: " .. states [ frontRight ] .. ", Rear-Left: " .. states [ rearLeft ] .. ", Rear-Right: " .. states [ rearRight ], thePlayer ) else outputChatBox ( "You have to be in a vehicle to use this command.", thePlayer ) 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