-2

I was wondering how to create a timer in lua that works also in servers with no players on. Timer.Simple or Timer.Create don't work, they need CurTime(). How could I do it?

Lario
  • 5
  • 3

2 Answers2

0

Well one option is always to set the convar sv_hibernate_think to 1. That is also the option provided on the official Wiki as shown here.

Luiggi33
  • 21
  • 3
-1

Depends on what's available. You likely can't import any extra libs, and Lua's capabilities have 'prolly been nerfed.

If standard clock capabilities still exist, you can do something with

local init, pause = os.clock(), 3
while os.clock() -init < pause do end

I don't know your exact use; could be made into a function if need be. That will eat up clock cycles. If coroutines exist, you might be able to have another script runing in the background while occasionally checking on timer.

Doyousketch2
  • 2,060
  • 1
  • 11
  • 11