GetVehicleUpgradeOnSlot: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 6: Line 6:


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">getVehicleUpgradeOnSlot ( vehicle, slot )</syntaxhighlight>
<syntaxhighlight lang="lua">getVehicleUpgradeOnSlot ( vehicle theVehicle, int slot )</syntaxhighlight>


===Returns===
===Returns===
Line 12: Line 12:


===Required Arguments===
===Required Arguments===
*'''vehicle''': The [[vehicle]] whose upgrade you want to retrieve.
*'''theVehicle''': The [[vehicle]] whose upgrade you want to retrieve.
*'''slot''': The slot id of the upgrade.
*'''slot''': The slot id of the upgrade.


Line 20: Line 20:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function scriptOnPlayerEnterVehicle ( theVehicle, seat, jacked )
function scriptOnPlayerEnterVehicle ( theVehicle, seat, jacked )
  for i=0, 16 do
    for i=0, 16 do
    local upgrade = getVehicleUpgradeOnSlot ( i )
        local upgrade = getVehicleUpgradeOnSlot ( i )
    if ( upgrade ) then
        if ( upgrade ) then
      tputChatBox ( getVehicleUpgradeSlotName ( i ) .. ": " .. upgrade)
            outputChatBox ( getVehicleUpgradeSlotName ( i ) .. ": " .. upgrade)
        end
     end
     end
  end
end
end
addEventHandler ( "onPlayerEnterVehicle", getRootElement(), scriptOnPlayerEnterVehicle )
addEventHandler ( "onPlayerEnterVehicle", getRootElement(), scriptOnPlayerEnterVehicle )
end</syntaxhighlight>
</syntaxhighlight>
</section>
</section>


==See Also==
==See Also==
{{Vehicle functions}}
{{Vehicle functions}}

Revision as of 17:07, 17 August 2007

Description

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

getVehicleUpgradeOnSlot ( vehicle theVehicle, int slot )

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.

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 ( i )
        if ( upgrade ) then
            outputChatBox ( getVehicleUpgradeSlotName ( i ) .. ": " .. upgrade)
        end
    end
end
addEventHandler ( "onPlayerEnterVehicle", getRootElement(), scriptOnPlayerEnterVehicle )

See Also