setVehicleHandling
Server
Changes a vehicle's handling for every player.
Also exists on the client, with its own implementation: setVehicleHandling
bool setVehicleHandling(vehicle vehicle [, string|bool property = nil, any value = nil, bool useOriginal = false])
Parameters
| Name | Type | Description |
|---|---|---|
| vehicle | vehicle | The vehicle. |
| property | string|bool | The property's name, as in getVehicleHandling. nil or false puts every property back to the model's handling (setModelHandling); true, to the original handling. An unknown name raises an error.default nil |
| value | any | The new value. nil puts the property back to the model's handling. Of the property's type: a number, a boolean for ABS, a string for the names, or {x, y, z} (or a vector) for centerOfMass. A wrong type raises an error.default nil |
| useOriginal | bool | Only when value is nil: true puts the property back to the original handling instead of the model's.default false |
Returns
true if the change was made. false if the value is outside the property's limits or property is not a string, a boolean or nil.
Example
addCommandHandler("drift", function(player)
local vehicle = getPedOccupiedVehicle(player)
if vehicle then
setVehicleHandling(vehicle, "driveType", "rwd")
setVehicleHandling(vehicle, "tractionLoss", 0.6)
end
end)
addCommandHandler("stock", function(player)
local vehicle = getPedOccupiedVehicle(player)
if vehicle then
setVehicleHandling(vehicle, true)
end
end)NoteThe suspension properties only take effect on cars and monster trucks; other vehicles keep the original ones.