GetVehicleVariant

From Multi Theft Auto: Wiki

This function gets the variant of a specified vehicle. In GTA SA 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 GTA SA 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: A handle to the vehicle that you want to get the variant of.

Returns

On success:

On failure:

  • bool: False because the specified vehicle didn't exist

Example

Click to collapse [-]
Client

This example tells the person in the vehicle what their vehicle variants are using: getvehvar

function getMyVehiclesVariant()
    local myVeh = getPedOccupiedVehicle(localPlayer) -- Get the vehicle that they're in
    if (myVeh) then
        local var1, var2 = getVehicleVariant(myVeh) -- Get the info
        outputChatBox("This vehicles variants: "..tostring(var1).." "..tostring(var2)) -- Output the info
    end
end
addCommandHandler("getvehvar", getMyVehiclesVariant)

Requirements

Minimum supported server 1.2
Minimum supported client 1.2

Note: Using this function requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.2" client="1.2" />

See Also

FROM VERSION 1.5.7 r19626 ONWARDS
FROM VERSION 1.6 r7485 ONWARDS
FROM VERSION 1.6 r7485 ONWARDS