GetVehicleUpgradeSlotName: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(7 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | |||
This function returns the name of an upgrade slot name (e.g. roof, spoiler). | This function returns the name of an upgrade slot name (e.g. roof, spoiler). | ||
Line 10: | 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. | ||
{{Vehicle Upgrades}} | |||
===Returns=== | ===Returns=== | ||
Line 15: | Line 17: | ||
==Example== | ==Example== | ||
<section name="Server" class="server" show="true"> | |||
This example prints the name and upgrades on each slot of an entered vehicle to the chat. | This example prints the name and upgrades on each slot of an entered vehicle to the chat. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function | function scriptOnPlayerEnterVehicle ( theVehicle, seat, jacked ) | ||
local upgrades = getVehicleUpgrades ( theVehicle ) | |||
for _, upgrade in ipairs ( upgrades ) do | |||
outputChatBox ( getVehicleUpgradeSlotName ( upgrade ) .. ": " .. upgrade ) | |||
end | |||
end | end | ||
addEventHandler ( " | addEventHandler ( "onPlayerVehicleEnter", root, scriptOnPlayerEnterVehicle ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{Vehicle_functions}} | {{Vehicle_functions}} |
Latest revision as of 08:34, 4 November 2020
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.
- 0: Hood
- 1: Vent
- 2: Spoiler
- 3: Sideskirt
- 4: Front Bullbars
- 5: Rear Bullbars
- 6: Headlights
- 7: Roof
- 8: Nitro
- 9: Hydraulics
- 10: Stereo
- 11: Unknown
- 12: Wheels
- 13: Exhaust
- 14: Front Bumper
- 15: Rear Bumper
- 16: Misc
Returns
Returns a string with the slot name if a valid slot or upgrade ID was given, false otherwise.
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 ) local upgrades = getVehicleUpgrades ( theVehicle ) for _, upgrade in ipairs ( upgrades ) do outputChatBox ( getVehicleUpgradeSlotName ( upgrade ) .. ": " .. upgrade ) 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