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)endaddEventHandler("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
- addVehicleSirens
- addVehicleUpgrade
- areVehicleLightsOn
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getHeliBladeCollisionsEnabled
- getModelHandling
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getVehicleAdjustableProperty
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleComponentPosition
- getVehicleComponentRotation
- getVehicleComponents
- getVehicleComponentScale
- getVehicleComponentVisible
- getVehicleController
- getVehicleCurrentGear
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleDummyPosition
- getVehicleEngineState
- getVehicleEntryPoints
- getVehicleGravity
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleIdleRespawnDelay
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelDummyDefaultPosition
- getVehicleModelDummyPosition
- getVehicleModelExhaustFumesPosition
- getVehicleModelFromName
- getVehicleModelWheelSize
- getVehicleName
- getVehicleNameFromModel
- getVehicleNitroCount
- getVehicleNitroLevel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleRespawnDelay
- getVehicleRespawnPosition
- getVehicleRespawnRotation
- getVehicleRotorSpeed
- getVehicleRotorState
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehiclesOfType
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgrades
- getVehicleUpgradeSlotName
- getVehicleVariant
- getVehicleWheelFrictionState
- getVehicleWheelScale
- getVehicleWheelStates
- isTrainChainEngine
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleNitroActivated
- isVehicleNitroRecharging
- isVehicleOnGround
- isVehicleRespawnable
- isVehicleSmokeTrailEnabled
- isVehicleTaxiLightOn
- isVehicleWheelOnGround
- isVehicleWindowOpen
- removeVehicleSirens
- removeVehicleUpgrade
- resetVehicleComponentPosition
- resetVehicleComponentRotation
- resetVehicleComponentScale
- resetVehicleDummyPositions
- resetVehicleExplosionTime
- resetVehicleIdleTime
- respawnVehicle
- setHeliBladeCollisionsEnabled
- setModelHandling
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setVehicleAdjustableProperty
- setVehicleColor
- setVehicleComponentPosition
- setVehicleComponentRotation
- setVehicleComponentScale
- setVehicleComponentVisible
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleDummyPosition
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleGravity
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleIdleRespawnDelay
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleModelDummyPosition
- setVehicleModelExhaustFumesPosition
- setVehicleModelWheelSize
- setVehicleNitroActivated
- setVehicleNitroCount
- setVehicleNitroLevel
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleRespawnDelay
- setVehicleRespawnPosition
- setVehicleRespawnRotation
- setVehicleRotorSpeed
- setVehicleRotorState
- setVehicleSirens
- setVehicleSirensOn
- setVehicleSmokeTrailEnabled
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelScale
- setVehicleWheelsRotation
- setVehicleWheelStates
- setVehicleWindowOpen
- spawnVehicle
- spawnVehicleFlyingComponent
- toggleVehicleRespawn
Vehicle Events
- onClientTrailerAttach
- onClientTrailerDetach
- onClientVehicleCollision
- onClientVehicleDamage
- onClientVehicleEnter
- onClientVehicleExit
- onClientVehicleExplode
- onClientVehicleNitroStateChange
- onClientVehicleRespawn
- onClientVehicleStartEnter
- onClientVehicleStartExit
- onClientVehicleWeaponHit
- onTrailerAttach
- onTrailerDetach
- onVehicleDamage
- onVehicleEnter
- onVehicleExit
- onVehicleExplode
- onVehicleRespawn
- onVehicleStartEnter
- onVehicleStartExit