LV Persistent Vehicles Lite
A complete persistent vehicle system for FiveM: your cars stay in the world, save state to MySQL, include a cinematic dealership, configurable garages and a built-in key system.
Introduction
LV Persistent Vehicles Lite is the official LV Scripts resource for servers that need real vehicle persistence without heavy external dependencies. Every purchased or spawned vehicle is stored in the database with position, damage, fuel, colors and lock state.
Unlike basic solutions, this script never deletes abandoned vehicles, restores the world after server or resource restarts, and optimizes performance with OneSync-compatible distance streaming.
lv-persistent-vehicles-lite ยท
Store product: lv-persistent-vehicles-lite ยท
Auth: license key + server IP
Features
๐พ MySQL persistence
Position, rotation, colors, damage, fuel, lock state and JSON props in lv_pv_vehicles.
๐ช Dealership
Private showroom with routing buckets, visual customization, test drive and bank/cash purchase.
๐ ฟ๏ธ Garages
Multiple public garages in config/garages.lua. Store and retrieve vehicles with the E zone.
๐ Key system
Lock with U, animation, lights and sound. Share or revoke keys between players.
๐ก OneSync streaming
Configurable spawn/despawn radius. Data stays in the DB even when the entity is inactive.
โก Smart saving
Writes to the DB only when there are real changes (dirty flags). Less MySQL load.
Requirements
| Component | Required | Notes |
|---|---|---|
| FiveM + OneSync | Yes | Infinity or Legacy with extended distance recommended |
| oxmysql | Yes | MySQL connection in server.cfg |
| ox_lib | No | Improves client notifications |
| ESX / QBCore / Standalone | One | Auto-detect with Config.Framework.Type = 'auto' |
| LV Scripts license | Yes | Generated at lvscripts.net bound to server IP |
Installation
-
Copy the resource into your
resources/folder:resources/lv-persistent-vehicles-lite/ -
Database โ run the SQL (also auto-installs on start):
lv-persistent-vehicles-lite/sql/install.sql -
server.cfg โ recommended order:
set mysql_connection_string "mysql://user:pass@localhost/dbname?charset=utf8mb4" ensure oxmysql ensure lv-persistent-vehicles-lite -
Configure
config.luawith your license, framework and garage/dealership locations. - Restart the server and check the console for successful license verification.
License
The license is generated in your LV Scripts panel after purchase. It must be bound to your FiveM server public IP.
Config.License = {
Key = 'LV-XXXX-XXXX-XXXX',
ApiBase = 'https://lvscripts.net',
RecheckInterval = 300000,
}
Enable Config.General.Debug = true temporarily to see the verification URL and API response in the server console.
Script strings (notifications, UI) are edited in locale.lua (plaintext file). Language: Config.UI.Locale = 'es' or 'en'.
Configuration
Persistence
Config.Persistence = {
SaveInterval = 60,
SaveOnExitVehicle = true,
SaveOnPlayerDrop = true,
SaveOnResourceStop = true,
FullVehicleState = true,
DeleteAbandoned = false,
SpawnOnStart = true,
UseRoutingBuckets = true,
}
Streaming (OneSync)
Config.Streaming = {
Enabled = true,
SpawnRadius = 350.0,
DespawnRadius = 450.0,
TickMs = 2500,
}
Dealership
Default location: PDM Legion Square. Customize in Config.Dealership:
Entranceโ player entry pointShowroomโ vehicle, camera and player preview positionTestDriveโ duration, spawn and return pointPaymentAccountโ'bank'or'cash'(ESX/QBCore)UseAllGtaVehiclesโ full GTA catalog or filtered list
Garages
Define garages in config/garages.lua. Each garage includes menu coords, store zones, spawn points and blips.
Keys
Config.Keys = {
LockToggle = 'U',
Interact = 38,
}
Dealership catalog
Edit config/gta_vehicles.lua or use Config.VehicleOverrides / Config.VehicleBlacklist.
Frameworks
Config.Framework = {
Type = 'auto',
AutoDetect = true,
}
| Framework | Detection | Payment account |
|---|---|---|
| QBCore | qb-core | QBCore Cash / Bank |
| ESX | es_extended | ESX Cash / Bank |
| Standalone | No framework | license: identifier |
With auto, detection order is: QBCore โ ESX โ Standalone.
qb-vehiclekeys, set Config.KeySystem.UseQBVehicleKeys = true.
By default the script uses its own LV key system.
In-game usage
| Action | How to |
|---|---|
| Enter dealership | Go to purple blip (PDM) โ press E |
| Buy vehicle | Select model, customize colors, confirm purchase |
| Test drive | From showroom โ Test Drive button (60 s default) |
| Open garage | Parking blip โ E at marker |
| Store vehicle | Drive to green garage zone โ E |
| Lock / unlock | Near vehicle โ U |
After restart
- Vehicles outside garage respawn at their last saved position.
- Vehicles in garage (
stored = 1) stay in DB without a world entity. - When the resource stops, entities are removed but data persists in MySQL.
Commands
| Command | Description |
|---|---|
/darllave [id] | Share keys to your nearby vehicle with another player (server ID) |
/quitarllave | Revoke shared keys from the current vehicle |
Exports (server)
Integrate with other resources using server exports:
local data = exports['lv-persistent-vehicles-lite']:GetVehicleData(vehicleId)
local vehicle = exports['lv-persistent-vehicles-lite']:GetVehicleByPlate('ABC 123')
Returned data includes owner, model, position, garage state, fuel, damage and JSON properties.
Database
| Table | Contents |
|---|---|
lv_pv_vehicles | Persistent vehicles: owner, plate, model, coords, fuel, damage, stored, props JSON... |
lv_pv_keys | Shared keys between players per vehicle |
The SQL installer creates indexes on owner and plate for fast queries with many vehicles.
Troubleshooting
Script won't start / invalid license
- Ensure the server public IP matches the license at lvscripts.net.
- Check
Config.License.Keyhas no extra spaces or quotes. - Enable
Config.General.Debug = trueand review the server console.
Vehicles don't persist
- Confirm oxmysql is connected (
ensure oxmysqlbefore the resource). - Check that
lv_pv_vehiclestables exist in your DB. - Verify
Config.Persistence.SpawnOnStart = true.
Dealership or garage not showing
- License must be active (without it all gameplay is disabled).
- Review coords in
Config.Dealershipandconfig/garages.lua. - Check
Config.Blips.EnabledandConfig.WorldMarkers.Enabled.
Performance with many vehicles
- Adjust
SpawnRadius/DespawnRadiusfor your population and hardware. - Increase
SaveIntervalif you have thousands of active vehicles. - Use garages often to keep vehicles at
stored = 1.