Hey ![]()
There are many factors to consider regarding vehicle persistence. It mostly depends on how you spawn a vehicle.
- Ambient spawn (like an NPC vehicle)? These will usually be gone if you are not close.
- client side through script? Can exist a little longer, doesn’t necessarily have to
- server side RPC native
CreateVehicle? Same as client side - server side native
CreateVehicleServerSetter? Enables “persistence” for that vehicle. (This is not perfect but it prevents a lot of despawns) - using
SetEntityOrphanModeserver side? Nearly the same as the setter but it allows setting this “persistence” state after the vehicle has been spawned through other means.
Afaik jg-advancedgarages supports both client and server side (with the setter) spawning and with the latter automatically enables some persistence.
Tl’dr: You need a resource that does this for you and especially for all the problems that persistence still has even when using the correct native functions.
There are lots of persistence resources out there that allow saving vehicles even across server restarts, though most of them are paid. I do offer one myself:
https://forum.cfx.re/t/advancedparking/2099582 (shameless plug, I know
)
There are others though, so feel free to look around.