Jump to content

Stopping the Timer [setTimer()]


Recommended Posts

Is there any way to stop a timer?

something like that?

  
setTimer( 
    function() 
        if getPlayerMoney(client) >= 1200 then 
            --do sth. 
        else 
            --[b][color=#FF0000]break[/color][/b] ? 
            --[b][color=#FF0000]return[/color][/b] ? 
            --[b][color=#FF0000]...[/color][/b] ? 
        end 
    end, 1000, [b][color=#FF0000]0[/color][/b] 
) 
  

Link to comment

Why not simply define it? That's how lua works basically:

local globalTimer1 = setTimer( 
function() 
    if getPlayerMoney(client) >= 1200 then 
        -- Do somethnig here 
    else 
        -- Kill timer 
        killTimer(globalTimer1) 
    end 
end, 1000, 0) 

You may be able to use "break" as well, never tried it myself even thought that's how you kill a timer in other languages.

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