addVehicleUpgrade
Shared
Fits a tuning upgrade on a vehicle, replacing whatever is on the same slot.
bool addVehicleUpgrade(element vehicle, string upgrade)
Parameters
| Name | Type | Description |
|---|---|---|
| vehicle | element | The vehicle, or a parent element whose vehicles all get the upgrade. |
| upgrade | string | The upgrade's model name (case does not matter), or "all" to fit a compatible upgrade on every slot. |
Returns
true if it was fitted. false if the upgrade does not suit the vehicle's model or the element is not a vehicle.
Given a parent element such as root, it applies to every vehicle below it, but the value returned is the element's own: false when it is not a vehicle.
Example
addCommandHandler("tunar", function(player)
local vehicle = getPedOccupiedVehicle(player)
if vehicle then
addVehicleUpgrade(vehicle, "all")
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.