enc0ded-persistent-vehicles
[THIS VERSION IS DEPRECIATED AND NO LONGER SUPPORTED; PLEASE USE VERSION 2.0]
Version 2.0 can be found on our Tebex Store
This mod prevents vehicles from disappearing in OneSync multiplayer servers. It can also respawn vehicles in their previous location after a server restart.
Features
- Respawns vehicles that have been unloaded by the game.
- Respawns all vehicles that were out before server restart.
- Performant: Only respawns vehicles when a player is closeby.
- Entity Management: Delete vehicle entities (npc included) that are far away from all players.
Requirements
FiveM Version >=2443
OneSync - This mod will not work without OneSync.
Installation
Download from the releases tab in GitHub. Extract and place the enc0ded-persistent-vehicles folder in your resources folder. Start the resource.
start enc0ded-persistent-vehicles
Usage
To make a vehicle persistent, pass its entity to the event below in a client script. For example if you are using ESX you can put this in the call back of the ESX.Game.SpawnVehicle function.
TriggerEvent('persistent-vehicles/register-vehicle', entity)
Stop a vehicle from being persistent and allow it to be removed as normal. Does not delete the vehicle.
Call this when a player puts away a vehicle. Also remember to call this on your admin delete vehicle commands.
TriggerEvent('persistent-vehicles/forget-vehicle', entity)
If you enable repopulate on reboot then you need to call the server event below before your server shuts down. 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('enc0ded-persistent-vehicles')
Console
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
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.