getVehicleCompatibleUpgrades
Shared
Returns the tuning upgrades that fit a vehicle's model.
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
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 MTAMTA 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.