Jump to content

[HELP] I got a problem with 'onVehicleDamage'


deltamta

Recommended Posts

Heyo,

I have a quick query because I'm trying to make a race function... I want to make a function that when your vehicle's health reaches to a critical moment so basically just before it starts burning, I want it to slowly start replenishing it's health to 30% in 30 seconds. ( I also want it to wait 10 seconds before the replenishment proccess starts ) Now I don't want it to pass 30% because then the script would not be fair for other players ... Here is my research till now :

  
  
--[[ Repair Script 
By *Delta^# ]] 
  
  
function setHealth ( loss ) 
    vehicle = source 
    setTimer ( 
        function () 
            local health = getElementHealth ( vehicle ) 
            outputChatBox ( health ) 
            if ( health <= 120 ) then 
                setElementHealth( vehicle, health + 30.0) 
            end 
        end, 1000, 0 
    ) 
end 
  
addEventHandler( "onVehicleDamage", getRootElement(), setHealth ) 
  
  
  

Thank you.

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