Browse docs

JG Mileage and HUD

Choose the mileage source and display Sky or JG Vehicle Mileage readings in JG HUD independently.

Sky Mechanic Job can count and save mileage itself, or read it from jg-vehiclemileage. The selected mileage can be displayed in the built-in Mileage HUD, JG HUD, or both. Using JG HUD does not require JG Vehicle Mileage.

Choose the source and display

Open /jobconfig → Mechanic Jobs → Features when Config.UseJobConfigurator is enabled. Saved configurator values take priority over the matching defaults in config/config.lua.

FeatureConfig keyPurpose
Mileage HUDConfig.ToggleFeatures.mileageHudShows the built-in Sky mileage display. Disabling it keeps mileage tracking, persistence, and wear active.
JG MileageConfig.ToggleFeatures.jgMileageReads mileage from jg-vehiclemileage while that resource is started. Requires JG Vehicle Mileage v2.1.1 or newer. Defaults to disabled.
JG HUDConfig.ToggleFeatures.jgHudSends the selected mileage to a started jg-hud through the adapter below. Works with either mileage source. Defaults to disabled.

Use these combinations for common setups:

SetupMileage HUDJG MileageJG HUD
Sky mileage with the Sky displayOnOffOff
Sky mileage shown only in JG HUDOffOffOn
JG Vehicle Mileage shown only in JG HUDOffOnOn

You can enable both display switches if you want both HUDs visible.

For Sky mileage shown only in JG HUD, set the three entries inside the existing Config.ToggleFeatures table when using file configuration:

sky_mechanicjob/config/config.lua
mileageHud = false,
jgMileage = false,
jgHud = true,

Keep the other feature entries. With the Job Configurator enabled, set the same switches in /jobconfig instead.

Connect JG HUD once

  1. Keep the resource folders named sky_mechanicjob and jg-hud.
  2. Open jg-hud/fxmanifest.lua. Add the following line after its existing client_scripts block, so it loads after framework/cl-functions.lua:
    jg-hud/fxmanifest.lua
    client_script "@sky_mechanicjob/compat/jg_hud_mileage.lua"
    
  3. After installing the updated Mechanic files and saving the manifest, run these commands in the server console:
    Server console
    refresh
    restart sky_mechanicjob
    restart jg-hud
    
  4. Enable JG HUD in /jobconfig and choose the source/display combination above. Ensure JG HUD's own vehicle mileage display is enabled, then enter a vehicle as the driver.

The adapter uses JG HUD's Framework.Client.GetVehicleMileageInKm integration point. It supplies the selected Mechanic mileage in kilometres; JG HUD keeps its own unit conversion and formatting. When the Sky display integration is disabled or Mechanic Job stops, JG HUD uses its original mileage getter again.

Keep this manifest addition when updating JG HUD. If an update changes its mileage getter, review the adapter against that version's framework/cl-functions.lua.

Resource availability and saved mileage

Mechanic Job checks the resource state before using either JG integration:

  • If JG Mileage is enabled but jg-vehiclemileage is missing, starting, or stopped, Mechanic Job uses Sky's saved mileage and continues counting distance. It logs the unavailable resource state instead of calling its exports.
  • Once jg-vehiclemileage is started, the enabled integration reads JG mileage again.
  • If JG HUD is enabled but jg-hud is unavailable, mileage tracking and wear continue. The HUD connection becomes active when JG HUD starts with the adapter loaded.

Switching the source does not copy mileage between Sky's database and JG Vehicle Mileage. Review the existing readings before switching a production server. A valid JG reading, including 0 or a lower corrected value, remains authoritative while JG Mileage is active.

The HUD adapter only supplies a display value. It does not write to JG Vehicle Mileage or replace JG's saved mileage. No SQL migration is required for the HUD connection.

Troubleshooting

JG HUD shows zero or a different value

Check that JG HUD is enabled, jg-hud is started, and the adapter line is present after the HUD's existing client scripts. Run refresh and restart JG HUD after changing its manifest. Test as the vehicle's driver after Mechanic Job has loaded the mileage.

Use JG Mileage = Off when Sky should remain the source. Turning that switch on selects JG Vehicle Mileage; it does not enable the HUD connection.

No such export getMileageByPlate in resource jg-vehiclemileage

This means the export was not registered in the requested runtime. Confirm the exact resource name, its running state, and the installed JG Vehicle Mileage version. Check the first startup error and update the resource if its exports do not match the JG server API and JG client API.

The availability check handles an absent or stopped provider. A resource reporting started can still have a startup error or an incompatible export API; those failures remain visible so the installation can be corrected. A JG mileage lookup failed for plate error is a separate case: the export exists, but JG returned no mileage record for that plate.