GetVehicleModelWheelSize

From Multi Theft Auto: Wiki
Revision as of 12:46, 4 September 2020 by AlexTMjugador (talk | contribs) (→‎Examples: : consistent indentation)
Jump to navigation Jump to search

This function gets the size of a group of wheels for a vehicle model.

Syntax

float|table getVehicleModelWheelSize ( int vehicleModel [, string wheelGroup ] )

OOP Syntax Help! I don't understand this!

Method: Vehicle.getModelWheelSize(...)
Counterpart: setVehicleModelWheelSize


Required Arguments

Optional Arguments

  • wheelGroup: The group of wheels of the vehicle model to retrieve their size value. If not specified, it defaults to all_wheels. The following values are supported:
    • front_axle: Represents the wheels in the front axle.
    • rear_axle: Represents the wheels in the rear axle.
    • all_wheels: Convenience group that returns all the wheel sizes in a table of the following format:
{ front_axle = 0.8, rear_axle = 0.7 }

Returns

Returns a decimal number or a table, depending on the specified wheel group. If the specified vehicle model ID or wheel group are not valid, an error is raised instead. The meaning of the wheel size values is documented in setVehicleModelWheelSize.

Example

This example adds a hoverme command that exploits the fact that the wheel size changes the ground clearance of a vehicle model to make it hover over the ground.

addCommandHandler("hoverme", function()
    local veh = getPedOccupiedVehicle(localPlayer)
    if veh then
        local vehicleId = getElementModel(veh)
        local currentSizes = getVehicleModelWheelSize(vehicleId)
        setVehicleModelWheelSize(vehicleId, "front_axle", currentSizes.front_axle * 2)
        setVehicleModelWheelSize(vehicleId, "rear_axle", currentSizes.rear_axle * 2)
        outputChatBox("Vehicle model wheel size doubled!", 0, 255, 0)
    else
        outputChatBox("You must be in a vehicle to use this command.", 255, 0, 0)
    end
end)

See Also