getVehicleHandling
Shared
Reads a vehicle's handling: its mass, engine, traction, suspension and the rest of what decides how it drives.
table|any getVehicleHandling(vehicle vehicle [, string property = nil])
Parameters
| Name | Type | Description |
|---|---|---|
| vehicle | vehicle | The vehicle. |
| property | string | A single property. An unknown name raises an error.default nil |
Returns
Without property, a table with every property. With it, that property's value. false if the vehicle has no handling.
Handling properties
| Type | Properties |
|---|---|
| Numbers | mass, turnMass, inertiaShape, dragCoeff, tractionMultiplier, engineAcceleration, engineInertia, maxVelocity, clutchUpShift, clutchDownShift, brakeDeceleration, brakeBias, steeringLock, tractionLoss, tractionBias, tractionLoadSensitivity, tractionSlipPeak, tractionSlipSlide, suspensionForceLevel, suspensionDamping, suspensionHighSpeedDamping, suspensionUpperLimit, suspensionLowerLimit, suspensionFrontRearBias, suspensionAntiDiveMultiplier, suspensionAntiRollFront, suspensionAntiRollRear, suspensionReboundRatio, collisionDamageMultiplier, seatOffsetDistance |
| Integers | percentSubmerged, numberOfGears, monetary, handlingFlags, modelFlags, animGroup |
| Boolean | ABS |
| Strings | driveType (fwd, rwd, awd), engineType (petrol, diesel, electric), headLight and tailLight (long, small, big, tall) |
| Table | centerOfMass ({x, y, z}) |
Example
addCommandHandler("handling", function(player)
local vehicle = getPedOccupiedVehicle(player)
if vehicle then
local handling = getVehicleHandling(vehicle)
outputDebugString(("mass %.0f, top speed %.0f"):format(handling.mass, handling.maxVelocity))
end
end)Coming from MTAIn MTA,
getVehicleHandling only returns the whole table. Here you can ask for one property.NoteAsked for on its own,
ABS comes back as a number (1 or 0); in the table, it is a boolean.