[ESX] Vehicle persistence, is it possible?

Hello everyone.

I bet there are lot of smart developers on here who have tried this already. And since I haven’t seen it done before on a fiveM ESX server, I assume it is impossible to do, but… I just want to be sure.

Can I accomplish vehicle persistence? So the server keeps track of all the cars that are spawned in by players, their state, plate and XYZ. The same as for spawnable objects like cones in esx_policejob. If you spawn them in one place, leave the area and come back it’s still there. Even if you knock it over and move it around. Then leave the area, when you return it’s still knocked over in the same spot that you last left it.

The server should save that information every 2 minutes or so in a file or DB. So when the server inevitably crashes, I can spawn in the cars from the list by admin command or even make it do so automaticly on bootup. To add to this, if a car is blown up, or despawned (by using the garage or impound) it should remove that from the list.

If the idea above is completely based on rainbow dust and I’m stupid for asking, than please tell me if the following is possible: Is it possible to trigger an action when a spawned vehicle is blown up. If I could just have DB table to store that a car with plate “XXX XXX” has been blown up, than I wouldn’t need vehicle persistence. And yes I did my research and all I was able to find is this:

It’s not exactly what I’m looking for because it needs a player to store every vehicle manually, It doesn’t register if a car is blown up and remove it from the spawn list. And I’m not sure if it saves license plates. I haven’t tested it my self.

Let me hear what you guys think.

Greetings!
Semper Fidelis

1 Like

So apparently I was able to make the above post without being logged in. My apologies if it causes any confusion but I meant to post this on my current account.

I’m posting this just because I want to know if you find something or managed to do this in the meantime.
I tried the resource you posted but doesn’t do what we want. But it is a great resource for placing vehicles and stuff like this.