Jump to content

healing


Xwad

Recommended Posts

Hi i made a script that makes possible when the player has skin id 20 and press H then he will be healed. Its not working:/ what should be the problem? the debugscript says its a bad argumentum (getElementalHealth)

  
function heal () 
    local theHealth = getElementHealth (localPlayer) 
    if getElementModel(source) == 20 then 
        if ( theHealth < 100 ) then 
            setElementHealth ( localPlayer, getElementHealth(localPlayer) + 50 ) 
            unbindKey("h","down",heal) 
            setTimer (bindTheKeys , 7000, 1 ) 
        end 
    end 
end 
  
function bindTheKeys () 
  bindKey ( "h", "down", heal )  
end 
bindTheKeys() 
  

Link to comment

This better:

bindKey("h", "down", 
function() 
    if not isTimer(hT) and getElementModel(localPlayer) == 20 then 
        local theHealth = getElementHealth(localPlayer) 
        if (theHealth < 100) then 
            setElementHealth(localPlayer, theHealth + 50) 
            hT = setTimer(function() hT = nil end, 7000, 1) 
        end 
    end 
end) 

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