Mileage Wear
Seven parts with configurable life, threshold and effect.
coe_mechanicMechanics & Workshops
Mileage-based part wear, tuning, paint, quotes and the Diagnostics app
coe_corecoe_databasecoe_loggingcoe_uicoe_vehiclescoe_inventorycoe_businessescoe_craftingcoe_vehicle_catalog
coe_mechanic
15 exports · 5 commands
Runs without a NUI: nothing is rendered on the client and the resource stays idle until events arrive.
Vehicle mechanics: every part (oil, filter, plugs, brakes, clutch, suspension) wears with coe_vehicles mileage since its last replacement, with no timers, and the effect reaches handling through coe_handling. Workshops are businesses with quotes, crafting benches (coe_crafting), stashes and the Diagnostics app on the tablet; includes visual tuning, paint and liveries.
Wear is computed from the authoritative odometer: used cars arrive worn and effects only grow past each part threshold.
Seven parts with configurable life, threshold and effect.
Quotes, staff and cash through coe_businesses.
Visuals, colors and liveries with quotes.
Tablet app showing each part condition.
Every COE Framework script strictly follows the principle of separation of concerns. Interact with the 3D stack below:
Built with vanilla HTML5, CSS3 tokens, and modern JavaScript. No heavyweight frameworks (React/Vue/Electron). Rendered directly in FiveM DX12's Chromium Embedded Framework at 0.00 ms while closed.
Manage your city without relying on developers. Runtime parameters, auditing, and ACE-protected commands:
IsPlayerAceAllowed(src, "coe.admin")
exports.coe_audit:Record(severity, category, event, context)
Clean Architecture & HAL
Typed contracts to call from other resources. Full types live in types.lua and in the docs reference.
exports['coe_mechanic']:TabletCall(source, appId, action, payload)
→ table
Handles workshop tablet actions (scan, replace). Accepts calls only from coe_tablet.
| Parameter | Type |
|---|---|
source | number |
appId | string |
action | string |
payload | table |
local result = exports['coe_mechanic']:TabletCall(source, appId, action, payload)exports['coe_mechanic']:Inspect(vehicleId)
→ CoePartStatus[]|nil
| Parameter | Type |
|---|---|
vehicleId | number |
local result = exports['coe_mechanic']:Inspect(vehicleId)exports['coe_mechanic']:ReplacePart(vehicleId, part)
→ true|string
Restricted to resources in WriterResources.
| Parameter | Type |
|---|---|
vehicleId | number |
part | string |
local result = exports['coe_mechanic']:ReplacePart(vehicleId, part)exports['coe_mechanic']:ServiceVehicle(vehicleId)
→ true|string
Replaces all parts in warning or critical condition.
| Parameter | Type |
|---|---|
vehicleId | number |
local result = exports['coe_mechanic']:ServiceVehicle(vehicleId)exports['coe_mechanic']:AdjustMileage(vehicleId, meters)
→ true|string
Corrects mileage (in meters); audited by coe_vehicles.
| Parameter | Type |
|---|---|
vehicleId | number |
meters | number |
local result = exports['coe_mechanic']:AdjustMileage(vehicleId, meters)exports['coe_mechanic']:AddWear(vehicleId, meters, parts)
→ true|string
Adds extra wear to parts (restricted to WearResources, currently coe_fuel). meters > 0 increases wear; meters < 0 removes previously accumulated extra wear, without making the part newer than when it was replaced. Resets when the part is replaced.
| Parameter | Type |
|---|---|
vehicleId | number|string |
meters | integer |
parts | string[] |
local result = exports['coe_mechanic']:AddWear(vehicleId, meters, parts)exports['coe_mechanic']:GetEffects(vehicleId, mileage)
→ {
Returns the effects of vehicle parts on handling, used by coe_handling.
| Parameter | Type |
|---|---|
vehicleId | number |
mileage | number|nil |
local result = exports['coe_mechanic']:GetEffects(vehicleId, mileage)exports['coe_mechanic']:ListParts()
→ string[]
No parameters.
local result = exports['coe_mechanic']:ListParts()exports['coe_mechanic']:IsReady()
→ boolean
No parameters.
local result = exports['coe_mechanic']:IsReady()exports['coe_mechanic']:GetShopOwner(shopId)
→ string|nil
| Parameter | Type |
|---|---|
shopId | string |
local result = exports['coe_mechanic']:GetShopOwner(shopId)exports['coe_mechanic']:GetAppearance(vehicleId)
→ CoeAppearance|nil
| Parameter | Type |
|---|---|
vehicleId | number |
local result = exports['coe_mechanic']:GetAppearance(vehicleId)exports['coe_mechanic']:QuoteAppearance(vehicleId, patch)
→ {
Returns a quote for a patch, proportional to catalog value, without saving it.
| Parameter | Type |
|---|---|
vehicleId | number |
patch | CoeAppearance |
local result = exports['coe_mechanic']:QuoteAppearance(vehicleId, patch)exports['coe_mechanic']:SetAppearance(vehicleId, patch)
→ true|string
Merges the patch into the saved appearance and applies it to the vehicle. Restricted to WriterResources; the caller handles payment.
| Parameter | Type |
|---|---|
vehicleId | number |
patch | CoeAppearance |
local result = exports['coe_mechanic']:SetAppearance(vehicleId, patch)exports['coe_mechanic']:GetShops()
→ table<string,
Returns the configured repair shops.
No parameters.
local ok, detail = exports['coe_mechanic']:GetShops()exports['coe_mechanic']:GetVehicleOptions(vehicle)
→ table|nil
Returns customization options and mods available for the vehicle entity. Client-side.
| Parameter | Type |
|---|---|
vehicle | integer |
local result = exports['coe_mechanic']:GetVehicleOptions(vehicle)/coe_appearance_options
Test tool: prints the visual options available for the current vehicle to F8.
/coe_appearance_quote <placa> <tipoMod> <indice>
Workshop tool: quotes a visual modification.
/coe_mechanic_mileage <placa> <km>
Test tool: sets the vehicle mileage to simulate wear (ACE command.coe_mechanic_mileage).
/coe_part_replace <placa> <peça>
Test tool: replaces a part and resets its wear (ACE command.coe_part_replace).
/coe_parts <placa>
Lists the vehicle parts with the wear of each one (ACE command.coe_parts).