# 🚗 Mileage System

### Main Features

* Multi frameworks support (QBCore, Qbox, ESX, ND)
* Customizable mileage display position on screen
* Option to track only player-owned vehicles
* Command to reset vehicle mileage
* Support for multiple vehicle database tables (QBCore & Qbox, ESX, ND, Custom)
* Support for multiple jobs with minimum grade
* Real-time mileage tracking for owned vehicles
* Version checker for the script
* Logging system for events and functions

### Vehicle Mileage Database UI <a href="#vehicle-mileage-database-ui" id="vehicle-mileage-database-ui"></a>

* Interactive vehicle mileage database panel accessible in-game
* Displays a list of vehicles with plate numbers and current mileage
* Allows editing of vehicle data including:
  * Mileage
  * Last oil change
  * Last oil filter change
  * Last air filter change
  * Last tire change
  * Last brakes change and brake wear
  * Last clutch change and clutch wear
  * Last suspension change
  * Last spark plug change
* Validation to ensure data consistency (e.g., last change values not exceeding mileage)
* Supports deleting vehicles with user confirmation
* Real-time updates and notifications for successful or failed operations
* Custom confirmation modal for user actions

### Mileage UI Customizer <a href="#mileage-ui-customizer" id="mileage-ui-customizer"></a>

* Allows players to toggle visibility of mileage and wear displays
* Provides sliders to adjust size of mileage meter and wear bars
* Allows precise positioning of UI elements via X and Y coordinates inputs
* Supports dragging UI elements to reposition them interactively
* Saves player customization settings persistently
* Enhances user experience with customizable and flexible UI layout

### Spark Plug System

* Spark plug wear tracking based on distance
* Maintenance interval configuration
* Engine misfire simulation when spark plugs are worn
* Spark plug replacement service with progress bar and animation
* Warning notifications for spark plug maintenance
* Cancelable maintenance procedures

### Oil System

* Oil life monitoring based on distance traveled
* Configurable oil change intervals
* Engine damage simulation when oil maintenance is neglected
* Visual warnings for low oil life
* Oil change service interaction for mechanics with progress bar and animation
* Cancelable maintenance procedures

### Oil Filter System

* Separate tracking for oil filter life
* Independent oil filter change intervals
* Engine performance impact when filter is worn
* Service option for filter replacement
* Warning system for filter maintenance
* Service option for filter replacement with progress bar and animation
* Cancelable maintenance procedures

### Air Filter System

* Air filter condition monitoring
* Performance impact on vehicle when filter is dirty:
  * Reduced top speed
  * Decreased acceleration
* Air filter replacement service
* Warning notifications for filter maintenance
* Air filter replacement service with progress bar and animation
* Cancelable maintenance procedures

### Tire System <a href="#p-7208502-tire-system-10" id="p-7208502-tire-system-10"></a>

* Tire wear tracking based on distance
* Impact on vehicle handling and grip
* Configurable tire wear rates and grip values
* Tire replacement service with progress bar and animation
* Visual wear indicators and warnings
* Cancelable maintenance procedures

### Brake System <a href="#p-7208502-brake-system-11" id="p-7208502-brake-system-11"></a>

* Progressive brake wear simulation
* Impact on braking efficiency
* Brake maintenance service with progress bar and animation
* Warning system for brake condition
* Configurable wear rates and efficiency loss
* Cancelable maintenance procedures

### Suspension System <a href="#p-7208502-brake-system-11" id="p-7208502-brake-system-11"></a>

* Suspension wear tracking and replacement service
* Configurable wear rates and maximum wear values
* Progress bar and animation for suspension service
* Cancelable maintenance procedures

### Clutch System <a href="#p-7208502-brake-system-11" id="p-7208502-brake-system-11"></a>

* Clutch wear tracking based on gear changes
* Impact on vehicle performance
* Engine stalls chance when clutch is worn out
* Clutch replacement service with progress bar and animation
* Warning system for clutch condition
* Configurable wear rates and performance loss
* Cancelable maintenance procedures

### Mechanic Interactions <a href="#p-7208502-mechanic-interactions-12" id="p-7208502-mechanic-interactions-12"></a>

1. Approach a vehicle
2. Use the target system (ox\_target or qb-target)
3. Available maintenance options:
   * Replace Spark Plugs
   * Change Oil
   * Replace Oil Filter
   * Replace Air Filter
   * Change Tires
   * Service Brakes
   * Service Suspension
4. Each interaction requires appropriate inventory items
5. Progress bars and animations for maintenance actions
6. Cancelable maintenance procedures

<figure><img src="/files/29ydAcgLqV2GVRxjUQ1K" alt=""><figcaption></figcaption></figure>

### HUD Features <a href="#p-7208502-hud-features-13" id="p-7208502-hud-features-13"></a>

* Real-time mileage display
* Configurable position (top-left, top-right, bottom-left, bottom-right)
* Component wear display when using /checkwear
* Warning notifications for maintenance needs
* Customizable UI size/position for players, saves in DB

<div align="center"><figure><img src="/files/suKdUtswPTDS705KihKv" alt="MILEAGE CUSTOMIZE MENU" width="390"><figcaption><p>Mileage customizer UI</p></figcaption></figure> <figure><img src="/files/0RvSTeG2Q8T3UAlKRGYa" alt="CHECK WEAR MENU" width="323"><figcaption><p>Checkwear UI</p></figcaption></figure></div>

### Disabled Vehicle Classes

* Option to disable mileage tracking and maintenance for specific vehicle classes such as:
  * Cycles
  * Boats
  * Helicopters
  * Planes
  * Trains
  * Military vehicles
  * Commercial vehicles

### Inventory System <a href="#inventory-system" id="inventory-system"></a>

* Integrated inventory support for:
  * Spark Plugs
  * Engine Oil
  * Oil Filter
  * Air Filter
  * Tires
  * Brake Parts
  * Suspension Parts
  * Clutch Parts
* Supports multiple inventory systems:
  * ox\_inventory
  * qb-inventory
  * Quasar inventory
  * CodeM inventory
  * ESX inventory
* Configurable item weights and descriptions
* Items can be used directly from inventory
* Automatic item removal after use

### Notification System <a href="#notification-system" id="notification-system"></a>

* Multiple notification system support:
  * QBox
  * QBCore
  * ESX
  * Wizard Notify
  * OkOk Notify
  * ox\_lib notify
* Configurable warning intervals
* Multi-language support

### Multiple Menu Support <a href="#multiple-menu-support" id="multiple-menu-support"></a>

* Supports multiple menu systems:
  * ox\_lib
  * QBCore/QBox menu


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://code-wizards.gitbook.io/codewizards/mileage-system.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
