# getVehicleCompatibleUpgrades (Shared)

> Returns the tuning upgrades that fit a vehicle's model.

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

## Syntax

```lua
table|false getVehicleCompatibleUpgrades(vehicle vehicle [, string|int slot = nil])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `vehicle` | `vehicle` | The vehicle. |
| `slot` | `string\|int` | Only the upgrades of this slot. The slot: its name (case does not matter) or its index, counted from 0 in the order of `getVehicleUpgradeSlots`. An unknown slot is an error. Without it, every slot. *(default: `nil`)* |

## Returns

A list of the upgrades' model names, or `false` if the vehicle has no model.

## Example

```lua
addCommandHandler("aleatorio", function(player)
    local vehicle = getPedOccupiedVehicle(player)
    if not vehicle then return end
    local upgrades = getVehicleCompatibleUpgrades(vehicle)
    if #upgrades > 0 then
        addVehicleUpgrade(vehicle, upgrades[math.random(#upgrades)])
    end
end)
```

### Coming from MTA

MTA uses numeric upgrade ids (1000 to 1193). Here an upgrade is its model's name, and the slots are the ones the mounted packs declare.

## See also

- [addVehicleUpgrade (Shared)](https://wiki.mymp.gg/en/addVehicleUpgrade.md): Fits a tuning upgrade on a vehicle, replacing whatever is on the same slot.
- [getVehicleUpgrades (Shared)](https://wiki.mymp.gg/en/getVehicleUpgrades.md): Returns every tuning upgrade fitted on a vehicle.
- [getVehicleUpgradeSlots (Shared)](https://wiki.mymp.gg/en/getVehicleUpgradeSlots.md): Returns the names of every upgrade slot the mounted packs declare.
