Wheel Theft

Exports

Exports

suty-wheeltheft exposes two client exports so a mechanic script can raise and lower a car with the same hydraulic jack and animations. They don't add, remove or check any item, don't steal wheels and don't give rewards.

placeJack

local accepted, reason = exports['suty-wheeltheft']:placeJack(vehicle, wheelIndex, onComplete)

Spawns a jack under that wheel and plays the placing and pumping animation. The player doesn't need the car_jack item.

removeJack

local accepted, reason = exports['suty-wheeltheft']:removeJack(vehicle, wheelIndex, onComplete)

Lowers the jack on that wheel, plays the pick-up animation and removes the jack.

Parameters

Parameter Type Description
vehicle number The vehicle entity handle on this client, not a network ID. If you have a network ID, convert it first with NetToVeh(netId)
wheelIndex number 0 front left · 1 front right · 2 rear left · 3 rear right
onComplete function, optional Called as onComplete(success, reason) when the animation ends

Return values

Return Meaning
true The action was accepted and scheduled. It is not finished yet: wait for onComplete
false, reason The action was refused. onComplete is not called

Reasons

Reason When
busy Another jack action or a progress bar is already running, or the player is setting something down
invalid_vehicle vehicle isn't an existing vehicle
invalid_wheel wheelIndex isn't 0–3
invalid_ped The player is dead or inside a vehicle
invalid_callback onComplete isn't a function
too_far The player is more than 3 m from the wheel (place) or the jack (remove)
cannot_place That wheel already has a jack, or the wheel is missing
no_jack There is no jack on that wheel to remove
needs_block The wheel was taken off: put a block (or a wheel) back before removing the jack
no_control The vehicle could not be synced to this client
cancelled The animation didn't complete (no ground or lifting point, or it was cancelled)
error Unexpected error. Check the F8 console

Example

Call it from your mechanic script's client, after your own job and item checks:

local function raiseFrontLeft(vehicle)
    local ok, accepted, reason = pcall(function()
        return exports['suty-wheeltheft']:placeJack(vehicle, 0, function(success, why)
            if success then
                -- the car is up: start your repair here
            else
                lib.notify({ description = ('Jack failed: %s'):format(why or 'unknown'), type = 'error' })
            end
        end)
    end)
    if not ok or not accepted then
        lib.notify({ description = ('Could not place the jack: %s'):format(ok and reason or 'export error'), type = 'error' })
    end
end

Rules

  • Place and remove a jack from the same client: the jack belongs to the player who placed it, and these exports don't pass it to another mechanic.
  • Exported jacks are separate from the theft and mechanic steps, and they don't survive a resource restart.
  • The callback isn't guaranteed if either resource stops during the action.
  • Only one action runs at a time. After a cancelled lowering, the jack stays in place and you can try again.
  • Your script is responsible for any job, item or server-side checks.

Item exports

useCarJack, useImpactDrill and useWheel are the ox_inventory item exports (client.export in the item entries). They expect ox_inventory's item data and slot, and aren't meant to be called by other scripts.

Merry Christmas.

From Suty.