Vehicle Persist

Vehicle Persist saves vehicles after players enter them and restores missing vehicles near players. Saved vehicles survive resource and server restarts, including their last saved position, modifications, and damage.

{:links-list}

INSTALLATION

  1. Open the downloaded ZIP file and copy the complete BigDaddy-VehiclePersist resource folder into your server's resources folder.
  2. Add your product key from your Big Daddy Scripts account to key1 under [licensing] in settings.ini.
  3. Enable OneSync and configure a supported MySQL provider. Start the database provider before BigDaddy-VehiclePersist.
  4. Adjust the persistence settings and blacklists in settings.json.
  5. Add ensure BigDaddy-VehiclePersist to your server.cfg after the database provider.

Example start order when using oxmysql:

ensure oxmysql
ensure BigDaddy-VehiclePersist

DO NOT RENAME THE FOLDER.

Keep the resource folder named BigDaddy-VehiclePersist. Licensing and resource integrations use this name.

{:is-danger}

REQUIREMENTS

REQUIREMENT DETAILS
FiveM server GTA V server with OneSync enabled.
Licensing A valid Big Daddy Scripts product key in settings.ini. Persistence starts after successful licensing.
Database A configured MySQL database using oxmysql, mysql-async, or ghmattimysql. The resource automatically detects the running provider.
Resource files Install the complete supplied resource, including its compiled client/server files, configuration, database script, and helper scripts.

The resource automatically creates the bd_persistent_vehicles table using the supplied database.sql. You do not normally need to import the SQL manually. Your database connection must allow the table to be created.

No framework, targeting system, inventory, or menu is required.

CONFIGURATION

Configure licensing in settings.ini and vehicle persistence in settings.json. Restart the resource after making changes.

settings.ini

SETTING DEFAULT DESCRIPTION
[licensing]
key1 Your product key Enter the product key from your Big Daddy Scripts account.
[settings]
debug false Supplied configuration value. Persistence tracking and respawn messages currently log regardless of this setting.
AcePermission command ACE permission required for the admin vehicle deletion command in the supplied configuration. If omitted, the deletion handler falls back to bigdaddy.vehiclepersist.admin. This command always checks ACE authorization, regardless of UseAcePermissions.

Leave the supplied licensing synchronization settings unchanged unless support instructs you otherwise.

settings.json

SETTING DEFAULT DESCRIPTION
deleteVehicleCommand dvpersist Admin vehicle deletion command name, without /. Use letters, numbers, underscores, or hyphens. Empty or invalid values fall back to dvpersist. Restart the resource after changing it.
serverUpdateIntervalMs 5000 Time between server persistence updates, in milliseconds. Refreshes existing tracked vehicles and checks for missing vehicles. Minimum: 1000.
clientSnapshotIntervalMs 5000 Time between vehicle snapshots while a player is driving, in milliseconds. Snapshots also occur when entering or leaving a vehicle. Minimum: 1000.
respawnDelayMs 10000 Minimum time a tracked vehicle must be missing before it can respawn. A player must also be within spawnDistance. Minimum: 1000.
spawnDistance 250.0 Distance in meters from the saved location within which a player must be for a missing vehicle to return. Minimum: 25.0.
duplicateMatchRadius 25.0 Distance in meters within which records with the same model and plate are treated as the same vehicle. Minimum: 2.0.
cleanupAfterDays 0 At startup, deletes saved records that have not been updated for this number of days. 0 disables age cleanup. This is based on database updates, not the last time a player drove the vehicle.
maximumVehicles 5000 Maximum tracked record count before new vehicles stop being added. Existing records continue to be managed; lowering this value does not delete them. Minimum: 1.
classBlacklist [21] Vehicle class IDs excluded from new tracking. Class 21 is trains, which require a different spawn method.
modelBlacklist [] Excluded vehicle model names or unsigned model hashes. An empty array excludes no models.
plateBlacklist [] Case-insensitive text matched anywhere in a vehicle's plate. An empty array excludes no plates.

Default settings.json

{
  "deleteVehicleCommand": "dvpersist",
  "serverUpdateIntervalMs": 5000,
  "clientSnapshotIntervalMs": 5000,
  "respawnDelayMs": 10000,
  "spawnDistance": 250.0,
  "duplicateMatchRadius": 25.0,
  "cleanupAfterDays": 0,
  "maximumVehicles": 5000,
  "classBlacklist": [21],
  "modelBlacklist": [],
  "plateBlacklist": []
}

For example, "modelBlacklist": ["rhino", "lazer"] excludes those models. "plateBlacklist": ["TEMP"] excludes any plate containing TEMP, including TEMP123.

Blacklists do not erase previously saved vehicles. Use the forget exports below when an existing saved record needs to be removed. Keep trains excluded from tracking.

{:is-warning}

HOW TO PLAY

  1. Enter a networked vehicle that is not blacklisted. Tracking starts automatically, including when entering as a passenger.
  2. Drive, customize, or park the vehicle normally. Driver snapshots save its detailed state, and server updates keep its position, health, and lock status current.
  3. Leave the vehicle parked. If its entity disappears, it becomes eligible to return after respawnDelayMs when a player is within spawnDistance of the saved location.
  4. After a resource or server restart, approach the saved location to restore the vehicle.

Persistence runs automatically. Administrators can remove vehicles with the command below.

What is saved?

  • Position, heading, and rotation.
  • Number plate and plate style.
  • Vehicle mods, toggle mods, extras, standard liveries, and roof liveries.
  • Paint and custom colors, wheels, drift tyres, window tint, xenon lights, neon lights, and tyre smoke colors.
  • Engine, body, and fuel tank health, door lock status, fuel level, dirt, and engine running state.
  • Burst tyres, missing doors, and broken windows.

Attached networked trailers are also captured as their own vehicle records. This does not save the towing attachment between the two vehicles.

At startup, nearby duplicate records with matching model and plate are consolidated. Before spawning a saved vehicle, the resource looks for a matching world vehicle to adopt. Choose duplicateMatchRadius carefully if your server uses identical models and plates for multiple vehicles parked together.

COMMANDS

COMMAND DESCRIPTION
/dvpersist Removes the selected vehicle's persistence record, then deletes the vehicle. Requires the configured ACE permission and must be used in-game.

Sit in the vehicle you want to delete, or stand within 5 meters of it. When on foot, the command selects the nearest vehicle in your routing bucket. It can delete both tracked and untracked networked vehicles. A tracked vehicle is only deleted after its persistence record has been successfully removed; a database failure leaves the vehicle intact.

To rename the command, change deleteVehicleCommand in settings.json, then restart the resource. For example, "deleteVehicleCommand": "removevehicle" changes it to /removevehicle.

Admin permissions

The supplied settings.ini uses AcePermission=command. The delete command always requires the configured ACE permission, even when UseAcePermissions is disabled.

To use a dedicated permission, set this value under the existing [settings] section in settings.ini:

AcePermission=bigdaddy.vehiclepersist.admin

Then grant that same permission to your admin group in server.cfg:

add_ace group.admin bigdaddy.vehiclepersist.admin allow

Make sure your administrators belong to group.admin. See the permissions guide for help assigning ACE permissions. Restart the resource after changing its configuration.

COMPATIBILITY AND VEHICLE DELETION

GARAGE AND DELETE SCRIPT INTEGRATION

Vehicle Persist cannot reliably tell whether another script intentionally deleted a vehicle or whether it disappeared accidentally. Without integration, vehicles removed by garages, impounds, cleanup scripts, or delete commands can return. Those scripts must stop persistence before deleting a tracked vehicle.

{:is-warning}

The resource is standalone. It does not automatically connect persistence to framework vehicle ownership, garage storage, keys, inventories, or fuel-resource data. Test these systems together, especially any other resource that restores vehicles or removes them from the world.

Client export

Call ForgetVehicle with the local vehicle entity handle before your existing deletion code:

exports['BigDaddy-VehiclePersist']:ForgetVehicle(vehicle)
DeleteVehicle(vehicle)

The client export sends a request to the server and does not return a success result. The server checks that the player is within 15 meters of the vehicle or its saved position. The vehicle must already be registered with the client. For server-controlled deletion that needs confirmation, use a server export and handle its completion before deleting the entity.

Server exports

EXPORT ARGUMENT RESULT
GetPersistentVehicleId(networkId) Vehicle network ID, not its entity handle. Saved record ID, or 0 if the network ID is not tracked.
ForgetVehicleByNetworkId(networkId) Vehicle network ID. Asynchronous result: true after the saved record is deleted, or false if no matching record was removed.
ForgetVehicleById(recordId) Saved persistence record ID. Asynchronous result: true after the saved record is deleted, or false if no matching record was removed.

The server forget exports return Task<bool> from C#. Integrations must handle asynchronous completion using their runtime's interop rather than assuming the export immediately returns a Lua boolean.

Forgetting a vehicle removes its persistence record; it does not delete the world entity. Your garage or deletion script must still remove the entity. A vehicle left in the world can be tracked again when a player enters it or sends another driver snapshot. Trailers have separate records and must be forgotten separately when your script removes them too.

TROUBLESHOOTING

Vehicles are not being saved

  • Check licensing messages in the server console and confirm the product key is set in settings.ini.
  • Confirm OneSync is enabled and the complete resource folder is installed.
  • Check that your database provider starts first. Look for Database table verified and Loaded ... persistent vehicles in the server console.
  • Confirm a player has entered the vehicle, that it is networked, and that its class, model, and plate are not blacklisted.
  • Check whether the number of tracked records has reached maximumVehicles.

A saved vehicle does not return

  • Approach its last saved position and allow time for both respawnDelayMs and the next server update.
  • Confirm its model is available on the server, especially for add-on vehicles.
  • Check whether age cleanup or a forget export removed the record.
  • Check the server console for database or vehicle spawn errors.

Deleted or garaged vehicles keep returning

Add the forget export to the script that removes the vehicle. A normal entity deletion alone does not remove the saved persistence record.

Settings or vehicle state do not match expectations

  • Check settings.json for valid JSON and restart the resource after editing it.
  • Check the server console for tracking, respawn, and forget messages.
  • Test whether another vehicle, garage, fuel, or customization resource overwrites the restored values.

The delete command does not work

  • Use the configured command in-game, while seated in a vehicle or within 5 meters of one.
  • Confirm the player's ACE permission matches AcePermission in settings.ini. Disabling UseAcePermissions does not bypass this command's permission check.
  • Restart the resource after renaming the command. Invalid names fall back to /dvpersist and produce a server console message.
  • If persistence is not ready or vehicle tracking is busy, wait and try again. Check the server console for database errors if persistence removal fails.
  • If persistence was removed but the vehicle entity could not be deleted, run the command again as instructed by the notification.

Quick installation check

Enter a networked vehicle, change its appearance or damage it, and leave it parked. Restart the server, approach its saved location, and confirm its position and saved state restore. Then test your integrated garage or deletion command and confirm the intentionally removed vehicle stays gone.

Test /dvpersist with an authorized admin and confirm an unauthorized player is denied. Check selection while seated and on foot, then wait beyond respawnDelayMs and restart the resource to confirm a deleted vehicle stays removed.