Jump to content

Carro não explode


Recommended Posts

Bom eu tava criando um script de quando o carro chega a uma certa vida ele não pega fogo e nem explode mais com isso eu escolhi uma vida baixa mais cada batida como vocês sabe pode dar dano ate demais e ate pegar fogo então queria saber pelo menos o nome do código que preciso fazer para setar a vida do carro

Edited by C0DE
Link to comment

Eu tentei usar setElementHealth so que não funcionou script abaixo

 

function vehicleHPVerify (loss)
	local thePlayer = getVehicleController (source)
	if (getElementHealth (source) < 300) then
		setVehicleDamageProof (source, true)
		setVehicleEngineState (source, false)
		setElementHealth( vehicle, 300 )
		if (thePlayer) then
			outputChatBox ("Seu veículo quebrou o motor. Chame um mecânico.", thePlayer)
		end
	end
end
addEventHandler ("onVehicleDamage", root, vehicleHPVerify)

function vehicleEngineDisable (thePlayer, seat, jacked)
	if (getElementHealth (source) < 300) then
		if (seat == 0) then 
			setVehicleDamageProof (source, true)
			setVehicleEngineState (source, false)
			setElementHealth( vehicle, 300 )
		end
	else 
		setVehicleDamageProof (source, false)
	end
end
addEventHandler ("onVehicleEnter", root, vehicleEngineDisable)


function antiVehicleEngine (cmd)
	if (cmd == "motor") then
		local theVehicle = getPlayerOccupiedVehicle (source)
		if (theVehicle) then
			if (getPedOccupiedVehicleSeat (source) == 0) then
				if (getElementHealth (theVehicle) < 300) then
					cancelEvent()
					outputChatBox ("O motor falhou.", source)
					setVehicleEngineState (theVehicle, false)
                    setElementHealth( vehicle, 300 )
				end
			end
		end
	end
end
addEventHandler ("onPlayerCommand", root, antiVehicleEngine)

 

Link to comment
  • Other Languages Moderators
17 hours ago, C0DE said:

Eu tentei usar setElementHealth so que não funcionou script abaixo

 


function vehicleHPVerify (loss)
	local thePlayer = getVehicleController (source)
	if (getElementHealth (source) < 300) then
		setVehicleDamageProof (source, true)
		setVehicleEngineState (source, false)
		setElementHealth( vehicle, 300 )
		if (thePlayer) then
			outputChatBox ("Seu veículo quebrou o motor. Chame um mecânico.", thePlayer)
		end
	end
end
addEventHandler ("onVehicleDamage", root, vehicleHPVerify)

function vehicleEngineDisable (thePlayer, seat, jacked)
	if (getElementHealth (source) < 300) then
		if (seat == 0) then 
			setVehicleDamageProof (source, true)
			setVehicleEngineState (source, false)
			setElementHealth( vehicle, 300 )
		end
	else 
		setVehicleDamageProof (source, false)
	end
end
addEventHandler ("onVehicleEnter", root, vehicleEngineDisable)


function antiVehicleEngine (cmd)
	if (cmd == "motor") then
		local theVehicle = getPlayerOccupiedVehicle (source)
		if (theVehicle) then
			if (getPedOccupiedVehicleSeat (source) == 0) then
				if (getElementHealth (theVehicle) < 300) then
					cancelEvent()
					outputChatBox ("O motor falhou.", source)
					setVehicleEngineState (theVehicle, false)
                    setElementHealth( vehicle, 300 )
				end
			end
		end
	end
end
addEventHandler ("onPlayerCommand", root, antiVehicleEngine)

 

Já vi o nome dessa function em algum lugar. Copiou de outro tópico...

Link to comment
  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...