Enable certain cars to not despawn

Hey people,

Is there any way to set a car you just spawned on the map using “CreateVehicle” function to not despawn? If so, could you provide me an snippet, please? (hours trying to figure this out, i just can’t)

Thanks in advance.

Stuck at the same.
Tried SetVehicleHasBeenOwnedByPlayer(veh_var,true) - no luck

Try SetEntityAsMissionEntity( car, true, true )

Thanks, forgot to clean cache. SetVehicleHasBeenOwnedByPlayer worked like a charm, cars stay at place all the time

1 Like

Would anything like this make sense in ESX_eden_garage? Should I even try it on the server? Don’t wanna do testing bunnies from my players by doing something out of scripting logic, since I am still newbie to coding :smile:

 function SpawnVehicle(vehicle)

ESX.Game.SpawnVehicle(vehicle.model, {
	x = this_Garage.SpawnPoint.Pos.x ,
	y = this_Garage.SpawnPoint.Pos.y,
	z = this_Garage.SpawnPoint.Pos.z + 1											
	},120, function(callback_vehicle)
	ESX.Game.SetVehicleProperties(callback_vehicle, vehicle)
	end)
SetVehicleHasBeenOwnedByPlayer
TriggerServerEvent('eden_garage:modifystate', vehicle, false)

end

Any advice will be appreciated!

Edit.: I haven’t been successful with implementation. I broke the whole script -.-