GetVehicleUpgradeSlotName

From Multi Theft Auto: Wiki
Revision as of 04:44, 17 September 2006 by Erorr404 (talk | contribs) (→‎Example)
Jump to navigation Jump to search

This function returns the name of an upgrade slot name (eg: roof, spoiler).

Syntax

There are two ways of using this function, the parameter can either be the slot id (0->16) or the upgrade id (1000->1193)

string getVehicleUpgradeSlotName ( slot )             
string getVehicleUpgradeSlotName ( upgrade )             

Required Arguments

  • vehicle: description
  • slot/vehicle: the slot or corresponding upgrade of which you want the name of.

Returns

Returns the slot name if a valid slot or upgrade id was given, false otherwise.

Example

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

addEventHandler ( "onPlayerEnterVehicle", root, "onPlayerEnterVehicle" )
function onPlayerEnterVehicle ( vehicle, seat, jacked )
  upgrades = getVehicleUpgrades ( vehicle )
  for upgradeKey, upgradeValue in upgrades do
    outputChatBox ( getVehicleUpgradeSlotName ( upgradeKey - 1 ) .. ": " .. upgradeValue )
  end
end

See Also

Template:Vehicle Functions