Jump to content

Carro não explode


Recommended Posts

Posted (edited)

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
Posted

 

setElementHealth

 

Hello, world.


Tutorial sobre interação de BOTs do Discord com o seu servidor - Visitar (Brazilian Portuguese)
Tutorial sobre tabelas - Visitar (Brazilian Portuguese)
Tutorial sobre banco de dados - Visitar (Brazilian Portuguese)
Posted

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)

 

Posted

Tenta:

"onClientVehicleDamage"
getElementHealth
cancelEvent
setElementHealth

 

Please do not PM me with scripting related question nor support, use the forums instead.

  • Moderators
Posted
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...

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanksspacer.png

Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile
Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment
Discord Oficial do MTA: https://mtasa.com/discord
Blacklist e Whitelist de Scripters: Planilha

Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.

  • 3 weeks later...
Posted
On 04/01/2019 at 12:46, Lord Henry said:

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

Não copiei de nenhum tópico

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...