# setVehicleHandling (Server)

> Changes a vehicle's handling for every player.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Server
- **Category**: Handling
- **URL**: https://wiki.mymp.gg/en/setVehicleHandling-server
- **Counterpart**: Also exists on the client, with its own implementation: [setVehicleHandling (Client)](https://wiki.mymp.gg/en/setVehicleHandling-client.md)

## Syntax

```lua
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

```lua
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)
```

### Note

The suspension properties only take effect on cars and monster trucks; other vehicles keep the original ones.

## See also

- [getVehicleHandling (Shared)](https://wiki.mymp.gg/en/getVehicleHandling.md): Reads a vehicle's handling: its mass, engine, traction, suspension and the rest of what decides how it drives.
- [setModelHandling (Server)](https://wiki.mymp.gg/en/setModelHandling.md): Changes a property of a vehicle model's handling, which new vehicles of that model start with.
- [getOriginalHandling (Server)](https://wiki.mymp.gg/en/getOriginalHandling-server.md): Reads a vehicle model's original handling, as the content packs declare it, without any script's changes.
- [setVehicleHandling (Client)](https://wiki.mymp.gg/en/setVehicleHandling-client.md): Changes a vehicle's handling on this client only.
