[HELP] Onesync delete vehicle

Ever since I activated onesync on my server, cars can no longer be deleted nor impounded. Does anyone know what’s the fix for this?

We use a three step delete/removal that has been fairly effective.

				print('Attempting to remove vehicle - take 1')
				ESX.Game.DeleteVehicle(vehicle)
				
				Citizen.Wait(500)
				
				if DoesEntityExist(vehicle) then
					print('Attempting to remove vehicle - take 2')
					SetEntityAsMissionEntity(vehicle, true, true)
					DeleteVehicle(vehicle)
				end
				
				if DoesEntityExist(vehicle) then
					print('Attempting to remove vehicle - take 3')
					DeleteEntity(vehicle)
				end

Might be overkill, but it has been working fairly reliably for us thus far.

1 Like

Where did you put that that code? If you don’t mind me asking

In one script it’s in a function RemoveVehicle(vehicle), in the garage script it’s right at the end of storing the vehicle. I should have mentioned, if you’re not an ESX based server, leave out the first part.

Will this fix it when a player goes like 10 metres or further from their owned vehicle, when they try to go inside the car they just get stuck on the animation of trying to get in?

It’ll let them/an admin delete the vehilce, but that’s about it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.