I was trying to make a timer that fires the save function. Can someone tweak?
Code:[HookMethod("Initq")] void Initq() { Instance = this; StartTimer(); Puts("before1"); } void StartTimer() { Puts("before2"); TimeSpan targetTime = TimeSpan.FromMinutes(1); // Start Save Data Every 5 minutes System.Threading.Thread.Sleep(targetTime.Milliseconds); Puts("before3"); SaveData(); StartTimer(); Puts("before4"); }private void SaveData() { }
Creating a timer before saving?
Discussion in 'Rust Development' started by Solomius™, Mar 23, 2016.
-
Wulf Community Admin
Use Oxide's timer API, not the System mess.
-
thanks, I will try
-
how to force to work the timer on start plugin?
I added a timer from manual, added the intermediate conclusion and realized that the timer never even starts -
Wulf Community Admin
Just add the timer or call the function where the timer is in Init(), Loaded(), or OnServerInitialized(). -
thanks, figured out
