M MY Multiplayer: Wiki
Side
Kind

setVehicleWheelState

Shared

Changes the state of one or more wheels of a vehicle: inflated, flat, fallen off or without collision.

bool setVehicleWheelState(element vehicle, int|string|table wheel, int state)

Parameters

NameTypeDescription
vehicleelementThe vehicle, or a parent element whose vehicles all change.
wheelint|string|tableWhich wheel: its number (0 front left, 1 rear left, 2 front right, 3 rear right), its frame name (wheel_lf, wheel_lr, wheel_rf, wheel_rr), a group (all, front_wheels, rear_wheels, left_wheels, right_wheels), -1 for all of them or a table of several.
stateintThe new state: 0 inflated, 1 flat, 2 fallen off, 3 drawn but without collision.

Returns

true if any wheel changed. false if the state is out of range, the vehicle lacks the wheel or it was already in that state.

Given a parent element such as root, it applies to every vehicle below it, but the value returned is the element's own: false when it is not a vehicle.

Example

addCommandHandler("furar", function(player)
    local vehicle = getPedOccupiedVehicle(player)
    if vehicle then
        setVehicleWheelState(vehicle, "rear_wheels", 1)
    end
end)

See also