GetVehicleUpgradeSlotName: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 20: Line 20:
function onPlayerEnterVehicle ( vehicle, seat, jacked )
function onPlayerEnterVehicle ( vehicle, seat, jacked )
   upgrades = getVehicleUpgrades ( vehicle )
   upgrades = getVehicleUpgrades ( vehicle )
   for upgradeKey, upgradeValue in upgrades do
   for upgradeKey, upgradeValue in ipairs(upgrades) do
     outputChatBox ( getVehicleUpgradeSlotName ( upgradeKey - 1 ) .. ": " .. upgradeValue )
     outputChatBox ( getVehicleUpgradeSlotName ( upgradeKey - 1 ) .. ": " .. upgradeValue )
   end
   end

Revision as of 22:35, 6 May 2007

This function returns the name of an upgrade slot name (e.g. roof, spoiler).

Syntax

There are two ways of using this function, the parameter can either be the slot ID (0 to 16) or an upgrade ID (1000 to 1193)

string getVehicleUpgradeSlotName ( int slot/upgrade )

Required Arguments

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

Returns

Returns a string with 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 ipairs(upgrades) do
    outputChatBox ( getVehicleUpgradeSlotName ( upgradeKey - 1 ) .. ": " .. upgradeValue )
  end
end

See Also