# setVehicleEngineSound (Client)

> Replaces a vehicle's engine sound on this client with a sound set from the mounted packs.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Vehicles
- **URL**: https://wiki.mymp.gg/en/setVehicleEngineSound

## Syntax

```lua
bool setVehicleEngineSound(vehicle vehicle [, string|false engine = false, string|false induction = false])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `vehicle` | `vehicle` | The vehicle. |
| `engine` | `string\|false` | The engine sound set's name, as listed by `getVehicleEngineSounds`. `false` or omitted goes back to the model's sound. *(default: `false`)* |
| `induction` | `string\|false` | The name of the sound set whose turbo or supercharger is used. `false` or omitted uses the engine set's own. *(default: `false`)* |

## Returns

`true` if the sound was replaced, `false` if the element is not a vehicle on this client.

The change applies on this client only and holds while the vehicle streams out and back in.

## Example

```lua
addCommandHandler("motor", function(command, engine)
    local vehicle = getPedOccupiedVehicle(localPlayer)
    if vehicle then
        setVehicleEngineSound(vehicle, engine or false)
    end
end)
```

### Coming from MTA

MTA has no such function. It follows FiveM's `ForceVehicleEngineAudio`.

### Note

A name no pack has raises no error: it is logged to `app.log` and the vehicle plays SA's original engine sound.

## See also

- [getVehicleEngineSound (Client)](https://wiki.mymp.gg/en/getVehicleEngineSound.md): Returns the engine and induction sounds setVehicleEngineSound put on a vehicle.
- [getVehicleEngineSounds (Client)](https://wiki.mymp.gg/en/getVehicleEngineSounds.md): Lists the engine sound sets the mounted packs bring.
