Browse docs

Client: GetVehicleMileage(vehicleOrPlate)

Reference for Client: GetVehicleMileage(vehicleOrPlate) in mechanicjob.

All exports

This page documents supported public integration calls and usage examples. It does not expose or reproduce the resource's internal implementation.

Client Exports

GetVehicleMileage(vehicleOrPlate)

  • Purpose: Returns mileage in kilometres for the supplied vehicle or plate. The local driver's active vehicle uses its current Mechanic reading. Other vehicle entities use JG while JG Mileage is enabled and jg-vehiclemileage is started, with the plate lookup used when no live JG reading is available.
  • Arguments:
    • vehicleOrPlate (number | string) - vehicle entity handle or vehicle plate text. Required.
  • Returns: number | nil - whole kilometres, or nil for invalid input or a failed lookup. A valid zero reading is preserved. See JG Mileage and HUD for source selection and the JG HUD adapter.
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
local mileage = exports["sky_mechanicjob"]:GetVehicleMileage(vehicle)

if mileage then
    print(("Mileage: %s"):format(mileage))
end