1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved cancelTask not work

Discussion in 'Plugin Help' started by BayAlper10, Aug 30, 2019.

  1. BayAlper10

    BayAlper10 Silverfish

    Messages:
    17
    GitHub:
    BayAlper10
    Hi,
    Im trying to use Task but it doesn't work. What do you think is the problem ?

    Code:
    if($dgen1l == 1){
                      $this->p->getScheduler()->scheduleRepeatingTask(new Demir($this), 100);
                      $config->set($arena . "Demir1level", 1.5);
                      $config->save();
                    }
    Code:
    $task = $this->p->getScheduler()->scheduleRepeatingTask(new Demir($this), 100)->getTaskId();
                    var_dump($task);
                    $this->p->getScheduler()->cancelTask($task);
     
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    What exactly doesn't work? What are you trying to do?
     
  3. BayAlper10

    BayAlper10 Silverfish

    Messages:
    17
    GitHub:
    BayAlper10
    I want to cancel the task but it does not stop
     
  4. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    You are creating a second task with the second part of code. You will need to save the first one and cancel it.
     
  5. BayAlper10

    BayAlper10 Silverfish

    Messages:
    17
    GitHub:
    BayAlper10
    Would you give me a sample, please?
     
  6. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    No, not without the rest of your code. Sorry.
     
    Fadhel and Awzaw like this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.