GetVehicleUpgradeOnSlot

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This function returns the current upgrade id on the specified vehicle's 'upgrade slot' An upgrade slot is a certain type of upgrade (eg: exhaust, spoiler), there are 17 slots (0 to 16).

Syntax

int getVehicleUpgradeOnSlot ( vehicle theVehicle, int slot )

OOP Syntax Help! I don't understand this!

Method: vehicle:getUpgradeOnSlot(...)


Returns

Returns an integer with the upgrade on the slot if correct arguments were passed, false otherwise.

Required Arguments

  • theVehicle: The vehicle whose upgrade you want to retrieve.
  • slot: The slot id of the upgrade. (Upgrade list ordered by slot number)

Example

Click to collapse [-]
Server

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

function scriptOnPlayerEnterVehicle ( theVehicle, seat, jacked )
    for i=0, 16 do
        local upgrade = getVehicleUpgradeOnSlot ( theVehicle, i )
        if ( upgrade ) then
            outputChatBox ( getVehicleUpgradeSlotName ( i ) .. ": " .. upgrade)
        end
    end
end
addEventHandler ( "onPlayerVehicleEnter", root, scriptOnPlayerEnterVehicle )

See Also