ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. addVehicleUpgrade

Function

addVehicleUpgrade

Server and clientVehiclesIdentical to MTA:SA

Fits a tuning part to a vehicle (spoiler, wheels, exhaust, nitro, hydraulics, bumpers…), visible and working for every player. The part must fit the model (getVehicleCompatibleUpgrades lists them). If the same slot already had a part, it is replaced; fitting the same part again changes nothing. New parts added with engineRequestModel work too.

Syntax

bool addVehicleUpgrade(vehicle vehicle, int upgrade)

Arguments

vehiclevehicle
The vehicle.
upgradeint
Part ID 1000-1193 (e.g. 1010 = nitro x10, 1080 = Switch wheels, 1087 = hydraulics) or a new ID from engineRequestModel.

Returns

true when the part was fitted; false when it does not fit the model or the ID is invalid.

Example

addCommandHandler("tuning", function(player)
    local vehicle = getPedOccupiedVehicle(player)
    if not vehicle then return end
    for _, part in ipairs({ 1010, 1080, 1087 }) do
        addVehicleUpgrade(vehicle, part)
    end
end)

Notes

Client. In a client script the part is for this player only (others do not see it); permanent tuning - on the server.

See also