Does SetEntityAsMissionEntity actually prevent vehicles from despawning?

Hello,

I am attempting to develop my own simple script to add some persistence to the vehicles I spawn.

After trawling this forum for a while, there doesn’t look to be a fully working solution - the Boot Vehicles mod looks promising but hasn’t been updated in a while and has lots of reports of duplicate vehicles spawning.

So on to the question; can anyone confirm if using the SetEntityAsMissionEntity FiveM Native will actually stop a vehicle from ever despawning (providing the player doesn’t disconnect)?

I use vMenu and that has a vehicle persistence mode, which I suspect just uses the above native, however I have had vehicles despawning while using that.

Thanks

As far as i know - yes, it works
However if the player will disconnect (that one who created vehicle and set it as mission entity) it will despawn.

Also there might be a small chance that vehicle will despawn if you are very far away (when the vehicle will change its owner)

Ahh okay maybe it was because I had spawned some cars down in the city, and we flew up to the north of the map.

Does the game reassign the vehicle to ‘no owner’ or something similar when you get too far away?

on OneSync closest player is the owner of entity (car, object, ped), not sure how it works without oneSync, i have also noticed that there are some sort of “limit” of vehicles that can be set as mission entity

Hmm, I am running my server via Zap Hosting (cheapest/easiest for me atm), and I see in the server config file:

onesync_enabled 0

I wonder if enabling onesync will cause any issues, as I also just found this release: [Release][OneSync] Enc0ded Persistent Vehicles

What if you trigger that event for every player on the server? it would mean that the vehicle would despawn if no one is on the server right?