[Help] Repair damaged Vehicle

Hello all,

I start make a mechanician script, so I would like to repair vehicle, I found some native function and I try to use it but nothing happen. Wwhen my character is next to a vehicle he should repair the damaged vehicle with an animation :

function RepairVehicle()
		Citizen.CreateThread(function()
		local ply = GetPlayerPed(-1)
		local plyCoords = GetEntityCoords(ply, 0)
		veh = GetClosestVehicle(plyCoords["x"], plyCoords["y"], plyCoords["z"], 5.001, 0, 70)
	    TaskStartScenarioInPlace(GetPlayerPed(-1), "WORLD_HUMAN_VEHICLE_MECHANIC", 0, true)        
	    Citizen.Wait(20000)
		SetVehicleFixed(veh, 1)
		SetVehicleDeformationFixed(veh, 1)
		SetVehicleUndriveable(veh, 1)
		ClearPedTasksImmediately(GetPlayerPed(-1))
	drawNotification("Le véhicule est maintenant ~g~réparé~w~.")
	end)
end

If someone could help me on this !

Regards,

1 Like

use raycast instead of closestvehicle. try