We've moved! Join us as we continue development on our new site at umod.org!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  1. Heyho, I am kind of new to oxide and wondering how I can destroy a timer.repeat?

    My source:

    Code:
     private void OnPlayerSleepEnded(BasePlayer player)
            {
    
                if (permission.UserHasPermission(player.UserIDString, perm))
                {
                 
                    timers.Repeat(seconds, 0, () =>
                    {
                    SendReply(player, "refreshed!");
           
    
                    });
                }
                else if (!permission.UserHasPermission(player.UserIDString, perm))
                {
                    SendReply(player, "Off");
                }
     
    Last edited by a moderator: Aug 17, 2018
  2. You have to store it in a variable, something like this
    Code:
    Timer t = null;
    
                t = timer.Repeat(1, 2, () => {
                    //Do some stuff here
    
                    if (something) t.Destroy();
                });
     
    Last edited by a moderator: Aug 17, 2018
  3. Exactly what I was looking for, thank you for your help Slydelix.