lua_backbround_script_timer.lua 502 B

12345678910111213141516171819
  1. -- Declare a shared "timer" counter and functions "timer"
  2. -- and "start" when the script is loading.
  3. shared.timer = 0
  4. function timer()
  5. -- Increment shared value.
  6. shared.timer = shared.timer + 1
  7. -- Return true to keep interval timer running or false to stop.
  8. return true
  9. end
  10. function start()
  11. -- The "start" function is called when the server is ready.
  12. -- At this point, a timer can be created.
  13. mg.set_interval(timer, 5)
  14. end
  15. -- Return false to abort server startup.
  16. return true;