getVehicleUpgrades | Multi Theft Auto: Wiki Skip to content

getVehicleUpgrades

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function returns a table of all the upgrades on a specifed vehicle.

OOP Syntax Help! I don't understand this!

  • Method:vehicle:getUpgrades(...)
  • Variable: .upgrades

Syntax

table getVehicleUpgrades ( vehicle theVehicle )
Required Arguments
  • theVehicle: The vehicle you wish to retrieve the upgrades of.

Returns

  • table: value

Returns a table of all the upgrades on each slot of a vehicle, which may be empty, or false if a valid vehicle is not passed.

Code Examples

shared

This example prints the name and upgrades on each slot of an entered vehicle to the chat.

function scriptOnPlayerEnterVehicle ( theVehicle, seat, jacked )
local upgrades = getVehicleUpgrades ( theVehicle )
for _, upgrade in ipairs ( upgrades ) do
outputChatBox ( getVehicleUpgradeSlotName ( upgrade ) .. ": " .. upgrade )
end
end
addEventHandler ( "onPlayerVehicleEnter", root, scriptOnPlayerEnterVehicle )

See Also

Vehicle Functions