GetVehicleUpgradeOnSlot: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (normalize page to match others) |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | {{Server client function}} | ||
This function returns the current upgrade id on the specified vehicle's 'upgrade slot' | This function returns the current upgrade id on the specified vehicle's 'upgrade slot' | ||
Line 7: | Line 6: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">int getVehicleUpgradeOnSlot ( vehicle theVehicle, int slot )</syntaxhighlight> | <syntaxhighlight lang="lua">int getVehicleUpgradeOnSlot ( vehicle theVehicle, int slot )</syntaxhighlight> | ||
{{OOP||[[vehicle]]:getUpgradeOnSlot}} | |||
===Returns=== | ===Returns=== | ||
Returns an ''integer'' with the upgrade on the slot if correct arguments were passed, ''false'' otherwise. | Returns an ''integer'' with the upgrade on the slot if correct arguments were passed, ''false'' otherwise. | ||
Line 13: | Line 12: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theVehicle''': 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. ''([[Upgrade list]] ordered by slot number)'' | ||
==Example== | ==Example== | ||
Line 27: | Line 26: | ||
end | end | ||
end | end | ||
addEventHandler ( " | addEventHandler ( "onPlayerVehicleEnter", root, scriptOnPlayerEnterVehicle ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> |
Latest revision as of 08:04, 5 August 2021
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 [-]
ServerThis 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
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates