Jump to content

setTimer(function()


Recommended Posts

Hi guys.

I have a problem.

My timer is not work and give this warning:

aP0D84.png

And my code:

healKac = guiGridListGetItemData ( NPCGrid, row, 1 ) 
makeHealTime = guiGridListGetItemData ( NPCGrid, row, 3 ) 
makeHealT = setTimer( function() -- Line 280 
    local health = getElementHealth(localPlayer) 
    if (health and health < 200) then 
        setElementHealth(localPlayer,health+healKac) 
    end 
end, makeHealTime, 0) 

Where is the problem?

Link to comment
  
healKac = guiGridListGetItemData ( NPCGrid, row, 1 ) 
makeHealTime = guiGridListGetItemData ( NPCGrid, row, 3 ) 
makeHealT = setTimer( function() -- Line 280 
    local health = getElementHealth(localPlayer) 
    if (health and health < 200) then 
        setElementHealth(localPlayer,health+healKac) 
    end 
end, makeHealTime, 50) 
  

3rd argument.. Your intervel of ms should not go down of 50.

Link to comment
  
healKac = guiGridListGetItemData ( NPCGrid, row, 1 ) 
makeHealTime = guiGridListGetItemData ( NPCGrid, row, 3 ) 
makeHealT = setTimer( function() -- Line 280 
    local health = getElementHealth(localPlayer) 
    if (health and health < 200) then 
        setElementHealth(localPlayer,health+healKac) 
    end 
end, makeHealTime, 50) 
  

3rd argument.. Your intervel of ms should not go down of 50.

You're completely wrong.

1. the 3rd argument is the time to execute.

2. the 2nd argument is the time interval.

So your code makes no sense.

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