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

spinner

Discussion in 'Facepalm' started by Teamblocket, Jun 24, 2017.

  1. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    ok so am making a plugin were the cratekey spins then stops after 1-2m , how can i stop the repeating task in 1-2m to disable?
     
  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    a stop task, to terminate the repeating task
    Code:
    function issuerepeat($repeatingTaskParams...,$whenToStop){
    $id = mtrand()
    while $this->repeats[$id] is set, $id = mtrand()
    $this->repeats[$id] = (register repeating task(which returns handler, we will set that as the handler))
    (register single delayed task with $id)
    }
    function stopById($id){(this is where the task will call with the provided ID)
    if isset $this->repeats[$id]
    $this->repeats[$id]->(clear/stop? cant remember exact method)
    unset($this->repeats[$id])
    endif
    }
    
    Note, this is clearly obviously not meant to be copied, and methods may not be exact, nor correct, this only should be ever served as an example and you should tweak where it feels necessary to
     
  3. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    one quick question public function or function?
     
  4. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    have you learnt PHP or PHP OOP before?
    it might worth taking a break and learning that first
    function is used for non oop programming sty;e,
    also here's a link about visibilitity, http://php.net/manual/en/language.oop5.visibility.php
    this pretty much tell you all you need to know about these keywords
     
  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.