GetVehicleVariant: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Remove obsolete Requirements section)
 
Line 31: Line 31:


</section>
</section>
==Requirements==
{{Requirements|1.2.0|1.2.0}}


==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 example

This 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