Jump to content

setTimer


BriGhtx3

Recommended Posts

  
function harndrang(Player) 
    local harndrangZahl = getElementData(Player, "harndrang") 
  
    setTimer(auffuellen, 1000, 10, Player, harndrangZahl) 
  
end 
  
function auffuellen(Player, harndrangZahler) 
setElementData(Player,"harndrang", tonumber(harndrangZahler+1)) 
end 

The script should set harndrang, every second +1 until it gets 10.

But it sets harndrang just, +1 and then stops.

Link to comment
 function harndrang(Player) 
     local harndrangZahl = tonumber(getElementData(Player, "harndrang")) 
     setTimer(auffuellen, 1000, 10, Player, harndrangZahl) 
end 
  
function auffuellen(Player, harndrangZahl) 
setElementData(Player,"harndrang", harndrangZahl + 1) 
end 

Link to comment
function harndrang(Player) 
    local harndrangZahl = getElementData(Player, "harndrang") 
    setTimer(auffuellen, 1000, 10, Player, harndrangZahl) 
end 
  
function auffuellen(Player, harndrangZahler) 
setElementData(Player,"harndrang", tonumber(harndrangZahler)+1) 
end 

Link to comment

I already fixed it.

I tried yous, doesn't work.

My solution :

    function harndrang(Player) 
        local harndrangZahl = getElementData(Player, "harndrang") 
        setTimer(auffuellen, 1000, 10, Player) 
    end 
      
    function auffuellen(Player) 
   local harndrangZahler = getElementData(Player, "harndrang") 
setElementData(Player,"harndrang", tonumber(harndrangZahler)+1) 
    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...