1. 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() {
    }
     
  2. Wulf

    Wulf Community Admin

  3. thanks, I will try
     
  4. 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
     
  5. Wulf

    Wulf Community Admin

    Just add the timer or call the function where the timer is in Init(), Loaded(), or OnServerInitialized().
     
  6. thanks, figured out