Prevent vehicle despawn

Hi,

Is there a way to keep cars on map, after player disconnection ?
For exemple if player has a timeout, he’ll spawn from anywhere without his car.

I’ve tried several ways without success, like : SetEntityAsMissionEntity, SetEntityAsNoLongerNeeded

For now, sometime cars don’t dispawn if someone is close of it.

Thanks

1 Like

This makes them despawn…

Try using this:

i allready use : SetVehicleHasBeenOwnedByPlayer(veh,true)

But vehicles despawn on player left, what should i do ?

Weird, I am not sure. Maybe someone else can help you

https://runtime.fivem.net/doc/reference.html#_0xAD738C3085FE7E11

It should prevent despawning an entity (I readed this somewhere)