Example which you can use an example, simply change the checking if the seat is empty, to check if its damaged then repair it.
local vehiclePool = GetGamePool('CVehicle') -- Get the list of vehicles (entities) from the pool
for i = 1, #vehiclePool do -- loop through each vehicle (entity)
if GetPedInVehicleSeat(vehiclePool[i], -1) == 0 then
DeleteEntity(vehiclePool[i]) -- Delete vehicles (entities) that don't have a driver