Permanent Damage Persistence
Vehicles emerge from garages retaining exact body deformations and mechanical wear.
coe_vehiclesFleet Synchronization, Damage & Tuning
Permanent Damage Persistence, Garages & Visual Tuning Modifications
coe_corecoe_databasecoe_vehicle_catalogcoe_ui
coe_vehicles
19 exports · 4 commands
Runs without a NUI: nothing is rendered on the client and the resource stays idle until events arrive.
Governs the entire lifecycle of citizen vehicles. Persists body panel denting, shattered glass, engine oil levels, brake pad wear, and fuel volume directly into MariaDB. Features public and private residential garages, digital wireless key locks, and comprehensive performance tuning.
Harnesses FiveM Enhanced server-authoritative networked entities, completely eliminating vehicle desync or despawns when looking away.
Vehicles emerge from garages retaining exact body deformations and mechanical wear.
Lock and unlock remotely; share digital guest keys with friends and faction members.
Engine oil, brake discs, and clutch require periodic servicing at mechanic shops.
Custom chameleon paint codes, bodykits, and turbocharger upgrades stored in database.
Every COE Framework script strictly follows the principle of separation of concerns. Interact with the 3D stack below:
Operates strictly within layers L1–L3 (domain, HAL, and server-authoritative application logic). Visual interactions and management flows are delegated to centralized ecosystem apps (coe_ui / coe_tablet), guaranteeing 0.00 ms idle client overhead in FiveM DX12.
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_vehicles']:Create(data)
→ CoeVehicle|string
Creates an authoritative vehicle record in MariaDB. Restricted to `WriterResources`.
| Parameter | Type |
|---|---|
data | CoeVehicleCreate |
local result = exports['coe_vehicles']:Create(data)exports['coe_vehicles']:Get(vehicleId)
→ CoeVehicle|string|nil
Retrieves a vehicle record by its unique database ID.
| Parameter | Type |
|---|---|
vehicleId | string |
local result = exports['coe_vehicles']:Get(vehicleId)exports['coe_vehicles']:GetByPlate(plate)
→ CoeVehicle|string|nil
Retrieves a vehicle record by its license plate string.
| Parameter | Type |
|---|---|
plate | string |
local result = exports['coe_vehicles']:GetByPlate(plate)exports['coe_vehicles']:ListByOwner(characterId)
→ CoeVehicle[]|string
Lists all vehicles owned by a specific character.
| Parameter | Type |
|---|---|
characterId | string |
local result = exports['coe_vehicles']:ListByOwner(characterId)exports['coe_vehicles']:GetEntity(vehicleId)
→ integer|nil
Returns the server-side FiveM entity handle if the vehicle is currently spawned in the world.
| Parameter | Type |
|---|---|
vehicleId | string |
local result = exports['coe_vehicles']:GetEntity(vehicleId)exports['coe_vehicles']:GetMileage(vehicleId)
→ number|string
Returns the cumulative vehicle odometer reading in integer meters.
| Parameter | Type |
|---|---|
vehicleId | string |
local result = exports['coe_vehicles']:GetMileage(vehicleId)exports['coe_vehicles']:SetMileage(vehicleId, meters)
→ true|string
Calibrates odometer reading (persists immediately with audit entry). Restricted to `MileageEditors`.
| Parameter | Type |
|---|---|
vehicleId | string |
meters | number |
local result = exports['coe_vehicles']:SetMileage(vehicleId, meters)exports['coe_vehicles']:Spawn(vehicleId, x, y, z, heading, vehicleType)
→ number|string
Spawns vehicle entity into the world, registers it with tracking state, and begins mileage accumulation.
| Parameter | Type |
|---|---|
vehicleId | string |
x | number |
y | number |
z | number |
heading | number |
vehicleType | string|nil |
local result = exports['coe_vehicles']:Spawn(vehicleId, x, y, z, heading, vehicleType)exports['coe_vehicles']:Store(vehicleId)
→ true|string
Flushes pending odometer distance, despawns the world entity, and transitions vehicle state to `stored`.
| Parameter | Type |
|---|---|
vehicleId | string |
local result = exports['coe_vehicles']:Store(vehicleId)exports['coe_vehicles']:IsReady()
→ boolean
Verifies if vehicle tables and migrations are ready for transactions.
No parameters.
local result = exports['coe_vehicles']:IsReady()exports['coe_vehicles']:HasKey(characterId, vehicleId)
→ boolean
Checks if a character holds digital key access. The owner inherently has key access; additional shared keys are queried from `coe_vehicle_keys`.
| Parameter | Type |
|---|---|
characterId | string |
vehicleId | string |
local result = exports['coe_vehicles']:HasKey(characterId, vehicleId)exports['coe_vehicles']:GiveKey(vehicleId, characterId)
→ true|string
Grants a digital key to a borrower character. Restricted to `WriterResources`.
| Parameter | Type |
|---|---|
vehicleId | string |
characterId | string |
local result = exports['coe_vehicles']:GiveKey(vehicleId, characterId)exports['coe_vehicles']:RevokeKey(vehicleId, characterId)
→ true|string
Revokes a borrowed digital key. Restricted to `WriterResources`.
| Parameter | Type |
|---|---|
vehicleId | string |
characterId | string |
local result = exports['coe_vehicles']:RevokeKey(vehicleId, characterId)exports['coe_vehicles']:ListKeyHolders(vehicleId)
→ string[]|nil
Lists all borrower character IDs (excluding the owner) holding digital keys to this vehicle.
| Parameter | Type |
|---|---|
vehicleId | string |
local result = exports['coe_vehicles']:ListKeyHolders(vehicleId)exports['coe_vehicles']:TransitionState(vehicleId, expectedState, nextState)
→ true|string
Transiciona atomicamente o estado do veículo. Somente WriterResources.
| Parameter | Type |
|---|---|
vehicleId | string |
expectedState | string |
nextState | string |
local result = exports['coe_vehicles']:TransitionState(vehicleId, expectedState, nextState)exports['coe_vehicles']:SetHousingVehiclePhase(vehicleId, expected, target)
→ boolean, string|nil
Altera a fase de manutenção de um veículo estacionado em garagem residencial/oficina. Somente WriterResources.
| Parameter | Type |
|---|---|
vehicleId | string |
expected | string |
target | string |
local ok, detail = exports['coe_vehicles']:SetHousingVehiclePhase(vehicleId, expected, target)exports['coe_vehicles']:IsHousingVehicle(vehicleId)
→ boolean
Verifica se o veículo está estacionado fisicamente em garagem residencial. Somente WriterResources.
| Parameter | Type |
|---|---|
vehicleId | string |
local result = exports['coe_vehicles']:IsHousingVehicle(vehicleId)exports['coe_vehicles']:ResumeHousingVehicle(vehicleId)
→ boolean, string|nil
Retoma o estado de veículo estacionado em garagem residencial após manutenção. Somente WriterResources.
| Parameter | Type |
|---|---|
vehicleId | string |
local ok, detail = exports['coe_vehicles']:ResumeHousingVehicle(vehicleId)exports['coe_vehicles']:RecoverHousingLocks()
→ boolean, string|nil
Recupera travas de manutenção pendentes após reinício. Somente WriterResources.
No parameters.
local ok, detail = exports['coe_vehicles']:RecoverHousingLocks()/chave_emprestar <id do jogador>
Lends the key of the nearest vehicle you own to a nearby player.
/chave_retirar <id do jogador>
Revokes the lent key of the nearest vehicle.
/coe_vehicle_create <modelo> [placa]
Test tool: creates a vehicle for the active character. ACE command.coe_vehicle_create.
/coe_vehicle_mileage <placa> <km>
Sets a vehicle mileage. ACE command.coe_vehicle_mileage.