Jump to content

killTimer / setTimer


spAik

Recommended Posts

Posted
addEventHandler('onGamemodeMapStart',getRootElement(), 
function() 
killTimer (votetime) 
local votetime = setTimer ( happen, 240000, 1 ) 
end) 

Hi

i want to start a function on the start of a map. I know my script does not work, because I set the "votetime"variable after the killTimer-function. But how can I make it that a timer is created before the map, but the previous timer is also destroyed at mapstart?

Posted

I'm not sure if I understand, you want to set a timer when a map starts, and if the timer was already started, kill it?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • Moderators
Posted
addEventHandler('onGamemodeMapStart',getRootElement(), 
function() 
    if isTimer(votetime) then 
        killTimer (votetime) 
    end 
    local votetime = setTimer ( happen, 240000, 1 ) 
end) 

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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