getVehicleUpgradeSlotName
Shared
Returns the name of an upgrade slot, from the slot's index or from an upgrade that goes on it.
string|false getVehicleUpgradeSlotName(int|string slotOrUpgrade)
Parameters
| Name | Type | Description |
|---|---|---|
| slotOrUpgrade | int|string | The slot's index, counted from 0 in the order of getVehicleUpgradeSlots, or an upgrade's model name. |
Returns
The slot's name, or false if the index does not exist or no vehicle takes the upgrade.
Example
addCommandHandler("pecas", function(player)
local vehicle = getPedOccupiedVehicle(player)
if not vehicle then return end
for _, upgrade in ipairs(getVehicleUpgrades(vehicle)) do
outputDebugString(upgrade .. " (" .. getVehicleUpgradeSlotName(upgrade) .. ")")
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.