So say I made a timer like, timer.Once(30, () => DoStuff)
How would I pull what number that timer is on so like when it reaches 20 I can broadcast. But I dont want to stop that timer as it would be user specific not allowing me to create a timer for 30, 20, 10, etc.
Solved Getting current timer count?
Discussion in 'Rust Development' started by DylanSMR, May 16, 2016.
-
Wulf Community Admin
I don't think you can get what count it is on. PS. This has been answered at least once before.
-
-
Wulf Community Admin
Code:var counter = 30; timer.Repeat(1f, counter, () => { Puts($"{counter - 1}"); });
-
That works, thanks!
[DOUBLEPOST=1463433144,1463366337][/DOUBLEPOST]Fixed: heres the code I am using.
Code:[ConsoleCommand("start")] void start() { var currenttimer = 10; var time = 10; screent = timer.Repeat(1f, currenttimer, () => { if(time == 1) { time = 0; currenttimer = 0; Puts("1"); timer.Once(1f, () => { Puts("Finished!!!"); }); screent.Destroy(); } else { Puts(time.ToString()); time--; } }); }
[DOUBLEPOST=1463511446][/DOUBLEPOST]If you want to see a full version of that I will release a full version via plugin submission soon