T3 // Vehicles & Fleet

coe_mechanic

Mechanics & Workshops

Mileage-based part wear, tuning, paint, quotes and the Diagnostics app

HEADLESS SERVICE (NO UI)
DEPENDS ON 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.

01 // OVERVIEW

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.

On FiveM Enhanced

Wear is computed from the authoritative odometer: used cars arrive worn and effects only grow past each part threshold.

02 // FEATURES

What the module delivers

01

Mileage Wear

Seven parts with configurable life, threshold and effect.

02

Workshop as a Business

Quotes, staff and cash through coe_businesses.

03

Tuning & Paint

Visuals, colors and liveries with quotes.

04

Diagnostics

Tablet app showing each part condition.

ARCHITECTURAL LAYERS // CLEAN ARCHITECTURE

4-Layer Isolation with 0.00 ms Idle

Every COE Framework script strictly follows the principle of separation of concerns. Interact with the 3D stack below:

L4
Presentation & NUI
HTML5 · CSS tokens · CoE UI
CEF DX12
L3
Application & Server
Atomic locks · Rate limiting
Auth Server
L2
Platform & HAL
Core.Platform · Mock natives
Gen9 HAL
L1
Domain & ACID Database
Prepared SQL · MariaDB pool
ACID Pool
LAYER 04 // PRESENTATION & NUI

Responsive NUI & CoE UI Design System

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.

Five themes supported in real time through CSS variables (--coe-accent, --coe-surface)
Fully keyboard-navigable (Tab, Esc, Enter) and ARIA-accessible
Secure asynchronous communication with the FiveM client via fetch("https://...")
ADMIN POWERS // OPERATION & MANAGEMENT

What this script delivers to Server Owners

Manage your city without relying on developers. Runtime parameters, auditing, and ACE-protected commands:

🛡️
ACE Permissions
Administrative operations strictly protected by coe.staff and coe.admin principals.
IsPlayerAceAllowed(src, "coe.admin")
📊
Ledger Auditing
Relevant actions write audit records to the database through coe_audit.
exports.coe_audit:Record(severity, category, event, context)
⚡
0.00ms Idle Telemetry
Event-driven thread dispatch that stays dormant until network events fire.
Clean Architecture & HAL
03 // EXPORTS

Public API 15

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.

ParameterType
sourcenumber
appIdstring
actionstring
payloadtable
LUA
local result = exports['coe_mechanic']:TabletCall(source, appId, action, payload)
exports['coe_mechanic']:Inspect(vehicleId) → CoePartStatus[]|nil

ParameterType
vehicleIdnumber
LUA
local result = exports['coe_mechanic']:Inspect(vehicleId)
exports['coe_mechanic']:ReplacePart(vehicleId, part) → true|string

Restricted to resources in WriterResources.

ParameterType
vehicleIdnumber
partstring
LUA
local result = exports['coe_mechanic']:ReplacePart(vehicleId, part)
exports['coe_mechanic']:ServiceVehicle(vehicleId) → true|string

Replaces all parts in warning or critical condition.

ParameterType
vehicleIdnumber
LUA
local result = exports['coe_mechanic']:ServiceVehicle(vehicleId)
exports['coe_mechanic']:AdjustMileage(vehicleId, meters) → true|string

Corrects mileage (in meters); audited by coe_vehicles.

ParameterType
vehicleIdnumber
metersnumber
LUA
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.

ParameterType
vehicleIdnumber|string
metersinteger
partsstring[]
LUA
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.

ParameterType
vehicleIdnumber
mileagenumber|nil
LUA
local result = exports['coe_mechanic']:GetEffects(vehicleId, mileage)
exports['coe_mechanic']:ListParts() → string[]

No parameters.

LUA
local result = exports['coe_mechanic']:ListParts()
exports['coe_mechanic']:IsReady() → boolean

No parameters.

LUA
local result = exports['coe_mechanic']:IsReady()
exports['coe_mechanic']:GetShopOwner(shopId) → string|nil

ParameterType
shopIdstring
LUA
local result = exports['coe_mechanic']:GetShopOwner(shopId)
exports['coe_mechanic']:GetAppearance(vehicleId) → CoeAppearance|nil

ParameterType
vehicleIdnumber
LUA
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.

ParameterType
vehicleIdnumber
patchCoeAppearance
LUA
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.

ParameterType
vehicleIdnumber
patchCoeAppearance
LUA
local result = exports['coe_mechanic']:SetAppearance(vehicleId, patch)
exports['coe_mechanic']:GetShops() → table<string,

Returns the configured repair shops.

No parameters.

LUA
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.

ParameterType
vehicleinteger
LUA
local result = exports['coe_mechanic']:GetVehicleOptions(vehicle)
04 // COMMANDS

In-game commands 5

/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).