This mod prevents vehicles from disappearing in OneSync ESX multiplayer servers. It can also respawn vehicles in their previous location after a server restart.
FiveM Version >=2443
OneSync - This mod will not work without OneSync.
esx_vehicleshop
Download from the releases tab in GitHub. Extract and place the esx-persistent-vehicles in your resources folder. Start the resource.
start esx-persistent-vehicles
Check config.lua and ensure the details match your database schema.
To make a vehicle persistent, pass it's license plate to the event below. This event cannot be called on the client with TriggerServerEvent, it must be called server side.
TriggerEvent('persistent-vehicles/register-vehicle', plate)
Stop a vehicle from being persistent and allow it to be removed as normal. Does not delete the vehicle.
TriggerEvent('persistent-vehicles/forget-vehicle', plate)
Before you shutdown your server you will need to save the vehicles to file. This will ensure that the vehicles spawn in the exact same location when the server comes back online.
TriggerEvent('persistent-vehicles/save-vehicles-to-file')
Alternatively you can stop the resource which will do this automatically.
StopResource('esx-persistent-vehicles')
Cull persistent vehicles
pv-cull <number of vehicles>
Unpersist vehicles
pv-forget-all
Toggle console debugging messages
pv-toggle-debugging
Save all persistent vehicles to file. Can be called before reboot.
pv-save-to-file
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.