I need /fix command which will automaticly repair car

Bro, this topic is over 2 years old xD haha
I think I commented on another of your posts earlier today too, where you used functions that served no purpose. Similarly here, you call the same one twice, for now reason. You should work on optimising your code. Why call “IsPedSittingInAnyVehicle” and return if false, then call it again to check if true? Bizarre… Also, if “GetVehiclePedIsIn” returns 0, then they aren’t in a vehicle, so calling “IsPedSittingInAnyVehicle” at all, after that, is redundant.

It’s good that you are trying to help people and answer threads, release scripts, etc. But the code should be better or you are teaching other people bad habits. Food for thought and I do wish you the best in becoming a better coder. Please take no offence, mate.

Anyway, for anyone that needs it.

RegisterCommand("fix", function()
	local ped = PlayerPedId()
	local vehicle = GetVehiclePedIsIn(ped, false)
	if vehicle ~= 0 and GetPedInVehicleSeat(vehicle, -1) == ped then
		SetVehicleFixed(vehicle)
		SetVehicleDeformationFixed(vehicle) -- Unsure if needed after SetVehicleFixed
		SetVehicleUndriveable(vehicle, false)
	end
end)