Jump to content

Meu veiculo quebra e para de funcionar, quando saio e entro volta a funcionar!


Recommended Posts

Tente com esse pra ver se funciona


function DesligarAndLigar ( playerSource )
   if math.floor ( getElementHealth( source ) + 0.5 ) > 350 then 
    setVehicleEngineState( source, false ) -- Quebrado
	--outputChatBox("Esse Veiculo está Quebrado, Chame Por um Mecanico digitando /Mecanicos", playerSource, 255, 255, 255, true)
    end 
end 
addEventHandler ( "onVehicleEnter", root, DesligarAndLigar )


addEventHandler("onVehicleDamage", getRootElement(),function(loss)
	if getElementType ( source ) == "vehicle" then
		if not isVehicleDamageProof(source) then
			local HP = getElementHealth(source)-loss		
			if HP <= 350 then 
				HP = 350 
				setElementHealth(source,350)
				setVehicleEngineState(source,false)
				setVehicleDamageProof(source,true)
				if isVehicleBlown(source) then
					fixVehicle(source)	
					setElementHealth(source,350)
					setVehicleDamageProof(source,true)
				end 
			end
		end	
	end	
end)

 

Edited by HiqueC
Link to comment

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