Installation
Overview
ml_vehicle_persistence saves eligible parked vehicles with their mods, colors, fuel and damage. Saved records survive disconnects and restarts; the vehicle entity streams in when a player is nearby. With World Vehicles enabled, the first driver can claim an eligible unowned vehicle, subject to exclusions and the parking limit.
Quick Start
- Download from CFX Portal
- Extract to your
resourcesfolder asml_vehicle_persistence - Add to
server.cfg:
1ensure oxmysql
2ensure ox_lib
3ensure ml_bridge
4ensure ml_vehicle_persistenceml_vehicle_persistence must start AFTER ml_bridge.
Database
The table is created automatically on first start. Existing installs are patched in place (missing columns are added on boot).
ml_vehicle_persistence: Stores each persisted vehicle: plate, owner, model, position, properties, fuel, damage
The SQL is also shipped in _INSTALL/schema.sql for manual creation.
Item Registration
All three items are optional. Register them in your inventory system for the features you enable:
vehicle_gps: Lists the owner's persisted and garaged vehicles and sets a waypoint. RequiresConfig.GpsItemgps_scanner: Thief tool that locates and rips out a vehicle's GPS. RequiresConfig.GpsScanner.enabledgps_module: Consumed by the owner to reinstall a removed GPS. RequiresConfig.GpsScanner.enabled
The definitions are in _INSTALL/items.lua. Set Config.GpsItem = false and Config.GpsScanner.enabled = false to skip them entirely.
Verify
After starting, the console prints the version banner. Once the table has rows, a restart also prints the load summary:
1[ml_vehicle_persistence] loaded 12 persisted vehicles (0 already in world)The script needs SetEntityOrphanMode, otherwise the engine can cull spawned vehicles and they would leave persistence. A red console error on boot means the FXServer artifact is too old.
- Vehicles not respawning after restart: confirm
Config.PersistThroughRestart = trueand that the database table has rows - Saved vehicles never appear near the player: raise
Config.SpawnDistanceor lowerConfig.ScanInterval; vehicles only spawn when a player is close - Claimed vehicles never appear: confirm
Config.WorldVehicles.enabled = trueand that the player sat in the driver seat - A script vehicle gets saved when it should not: call
exports.ml_vehicle_persistence:DoNotSave(plate)from the spawning resource - An admin
/dvbrings the vehicle back:Config.RespawnOnExternalDeleteistrue; set it tofalseor route the delete through the hook - Nothing persists at all: enable
Config.Debug = trueand read the console gate messages. A redDATABASE WRITE TEST FAILEDon boot means the table does not match