GetVehicleVariant: Difference between revisions
Jump to navigation
Jump to search
OpenIDUser32 (talk | contribs) No edit summary |
Fernando187 (talk | contribs) (Remove obsolete Requirements section) |
||
(4 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{Shared function}} | ||
__NOTOC__ | __NOTOC__ | ||
This function gets the variant of a specified vehicle. In GTA: San Andreas some vehicles are different; for example the labelling on trucks or the contents of a pick-up truck and the varying types of a motor bike. For the default variant list see: [[Vehicle variants]]. | |||
This function gets the variant of a specified vehicle. In GTA | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">int, int getVehicleVariant ( vehicle theVehicle )</syntaxhighlight> | <syntaxhighlight lang="lua">int, int getVehicleVariant ( vehicle theVehicle )</syntaxhighlight> | ||
{{OOP||[[vehicle]]:getVariant||setVehicleVariant}} | |||
==Required Arguments== | ===Required Arguments=== | ||
*'''theVehicle:''' | *'''theVehicle:''' The [[vehicle]] that you want to get the variant of. | ||
==Returns== | ==Returns== | ||
Returns 2 [[int]] containing the vehicle variants, ''false'' otherwise (the specified vehicle doesn't exist). | |||
==Example== | ==Example== | ||
<section name="Client" class="client" show="true"> | <section name="Client example" class="client" show="true"> | ||
This example tells the | This example tells the [[player]] in the [[vehicle]] what their vehicle variants are with a command named ''getvehvar'': | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function | function getMyVehicleVariants() | ||
local myVeh = getPedOccupiedVehicle(localPlayer) -- Get the vehicle that | local myVeh = getPedOccupiedVehicle(localPlayer) -- Get the vehicle that the player is in | ||
if | |||
local | if myVeh then | ||
outputChatBox("This | local variant1, variant2 = getVehicleVariant (myVeh) -- Get the vehicle variants | ||
outputChatBox ("This vehicle's variants are: "..tostring (variant1).." "..tostring (variant2)) -- Output the info to chatbox | |||
end | end | ||
end | end | ||
addCommandHandler("getvehvar", | |||
addCommandHandler ("getvehvar", getMyVehicleVariants) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> | ||
==See Also== | ==See Also== | ||
{{Vehicle functions}} | {{Vehicle functions}} |
Latest revision as of 15:35, 7 November 2024
This function gets the variant of a specified vehicle. In GTA: San Andreas some vehicles are different; for example the labelling on trucks or the contents of a pick-up truck and the varying types of a motor bike. For the default variant list see: Vehicle variants.
Syntax
int, int getVehicleVariant ( vehicle theVehicle )
OOP Syntax Help! I don't understand this!
- Method: vehicle:getVariant(...)
- Counterpart: setVehicleVariant
Required Arguments
- theVehicle: The vehicle that you want to get the variant of.
Returns
Returns 2 int containing the vehicle variants, false otherwise (the specified vehicle doesn't exist).
Example
Click to collapse [-]
Client exampleThis example tells the player in the vehicle what their vehicle variants are with a command named getvehvar:
function getMyVehicleVariants() local myVeh = getPedOccupiedVehicle(localPlayer) -- Get the vehicle that the player is in if myVeh then local variant1, variant2 = getVehicleVariant (myVeh) -- Get the vehicle variants outputChatBox ("This vehicle's variants are: "..tostring (variant1).." "..tostring (variant2)) -- Output the info to chatbox end end addCommandHandler ("getvehvar", getMyVehicleVariants)
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