Difference between revisions of "GetVehicleUpgradeSlotName"

From Multi Theft Auto: Wiki
Jump to: navigation, search
m (Example)
(Required Arguments)
Line 11: Line 11:
 
===Required Arguments===  
 
===Required Arguments===  
 
*'''slot/upgrade:''' the slot ID or corresponding upgrade ID of which you want the name.
 
*'''slot/upgrade:''' the slot ID or corresponding upgrade ID of which you want the name.
 +
You can find the '''Vehicle Upgrade Name''' here [http://wiki.mtasa.com/wiki/VehicleUpgradeNames#VehicleUpgradeNames]
  
 
===Returns===
 
===Returns===

Revision as of 16:06, 27 April 2010

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.

You can find the Vehicle Upgrade Name here [1]

Returns

Returns a string with the slot name if a valid slot or upgrade ID was given, false otherwise.

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 )
    local upgrades = getVehicleUpgrades ( theVehicle )
    for upgradeKey, upgradeValue in ipairs ( upgrades ) do
        outputChatBox ( getVehicleUpgradeSlotName ( upgradeKey - 1 ) .. ": " .. upgradeValue )
    end
end
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), scriptOnPlayerEnterVehicle )

See Also

FROM VERSION 1.6 r7485 ONWARDS
FROM VERSION 1.6 r7485 ONWARDS