setModelHandling | Multi Theft Auto: Wiki Skip to content

setModelHandling

Client-side
Server-side
Shared
Needs checking

This function was partially migrated from the old wiki. Please review manually:

  • Missing section: Handling Properties

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function is used to change the handling data of all vehicles of a specified model.

Syntax

bool setModelHandling ( int modelId, string property, var value )
Required Arguments
  • modelId: The vehicle model you wish to set the handling of.
  • property: The property you wish to set the handling of the vehicle to, or nil if you want to reset the all the handling properties.
  • value: The value of the models's handling property you wish to set, or nil if you want to reset the handling property to its default value.

Returns

  • bool: value

Returns true if the handling was set successfully, false otherwise.

Code Examples

shared

This example script changes the handling of all Bullet.

function handlingChange()
local modelId = 541
setModelHandling(modelId, "mass", 1890)
setModelHandling(modelId, "turnMass", 3780)
setModelHandling(modelId, "dragCoeff", 0.7)
setModelHandling(modelId, "centerOfMass", {0.0, 0.1, -0.2} )
setModelHandling(modelId, "percentSubmerged", 75)
setModelHandling(modelId, "tractionMultiplier", 0.70)
setModelHandling(modelId, "tractionLoss", 0.90)
setModelHandling(modelId, "tractionBias", 0.50)
setModelHandling(modelId, "numberOfGears", 5)
setModelHandling(modelId, "maxVelocity", 407)
setModelHandling(modelId, "engineAcceleration", 50)
setModelHandling(modelId, "engineInertia", 10)
setModelHandling(modelId, "driveType", "awd")
setModelHandling(modelId, "engineType", "petrol")
setModelHandling(modelId, "brakeDeceleration", 11)
setModelHandling(modelId, "brakeBias", 0.45)
setModelHandling(modelId, "ABS", false)
setModelHandling(modelId, "steeringLock", 30)
setModelHandling(modelId, "suspensionForceLevel", 0.80)
setModelHandling(modelId, "suspensionDamping", 0.20)
setModelHandling(modelId, "suspensionHighSpeedDamping", 0.0)
setModelHandling(modelId, "suspensionUpperLimit", 0.10)
setModelHandling(modelId, "suspensionLowerLimit", -0.09)
setModelHandling(modelId, "suspensionFrontRearBias", 0.5)
setModelHandling(modelId, "suspensionAntiDiveMultiplier", 0.6)
setModelHandling(modelId, "seatOffsetDistance", 0.3)
setModelHandling(modelId, "collisionDamageMultiplier", 0.50)
setModelHandling(modelId, "monetary", 1460000)
setModelHandling(modelId, "modelFlags", 0xC0222004)
setModelHandling(modelId, "handlingFlags", 0x1400000)
setModelHandling(modelId, "headLight", 1)
setModelHandling(modelId, "tailLight", 1)
setModelHandling(modelId, "animGroup", 0)
end
addEventHandler("onResourceStart", resourceRoot, handlingChange)

Issues

ID Description
553 setModelHandling doesn't work with already created vehicles
1198 "setModelHandling" function doesn't affect vehicles that have been changed using "setElementModel"

See Also

Vehicle Functions