Jump to content

Health Regen


Darkneblade

Recommended Posts

  
playerDamage = {} 
  
addEventHandler("onClientPlayerDamage", root, function() 
      playerDamage[localPlayer] = getTickCount() 
end 
) 
  
setTimer( 
function () 
if not playerDamage[localPlayer] or playerDamage[localPlayer] > 5000 then 
setElementHealth ( localPlayer, ( getElementHealth ( localPlayer ) + 15 ) ) 
end 
end,5000,0) 
end 
  

Edited by Guest
Link to comment
  
  
local lastDmg = 0; 
  
addEventHandler("onClientPlayerDamage",localPlayer, function() 
      lastDmg = getTickCount() 
end 
) 
  
setTimer( 
function () 
if lastDmg+5000 < getTickCount() and getElementHealth(localPlayer) < 100 then 
setElementHealth ( localPlayer, ( getElementHealth ( localPlayer ) + 15 ) ) 
end 
end,5000,0) 
end 

Link to comment
  
local lastDmg = 0; 
  
addEventHandler("onClientPlayerDamage",localPlayer, function() 
      lastDmg = getTickCount() 
end 
) 
  
setTimer( 
            function () 
            if lastDmg+5000 < getTickCount() and getElementHealth(localPlayer) < 100 then 
                setElementHealth ( localPlayer, ( getElementHealth ( localPlayer ) + 15 ) ) 
     end 
end,5000,0) 
  

Link to comment
local lastDamaged = 0 -- Define variable with default value '0' 
  
addEventHandler ( "onClientPlayerDamage", localPlayer, 
    function ( ) 
        lastDamaged = getTickCount ( ) -- Update the variable using getTickCount, which returns an integer containing the number of milliseconds since the system the server is running on started. 
    end 
) 
  
setTimer ( 
    function ( ) 
        if ( ( getTickCount ( ) - lastDamaged ) >= 5000 ) then -- If 5 seconds passed since last time the player got damaged.. 
            setElementHealth ( localPlayer, ( getElementHealth ( localPlayer ) + 15 ) ) -- Increase the player health by 15% 
        end 
    end 
    ,5000, 0 
) 

Link to comment
local lastDamaged = 0 -- Define variable with default value '0' 
  
addEventHandler ( "onClientPlayerDamage", localPlayer, 
    function ( ) 
        lastDamaged = getTickCount ( ) -- Update the variable using getTickCount, which returns an integer containing the number of milliseconds since the system the server is running on started. 
    end 
) 
  
setTimer ( 
    function ( ) 
        if ( ( getTickCount ( ) - lastDamaged ) >= 5000 ) then -- If 5 seconds passed since last time the player got damaged.. 
            setElementHealth ( localPlayer, ( getElementHealth ( localPlayer ) + 15 ) ) -- Increase the player health by 15% 
        end 
    end 
    ,5000, 0 
) 

thanks its working perfectly now :)

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