Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Cancel task

Comments in 'Plugin Development' started by AndrewBit, Jan 5, 2016.

  1. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    Hi! I know how to cancel task, but I have a problem...
    I code a minigame and now, when you play two times, the timer down 2 times faster, if you play 3 times, the timer down 3 times faster.
    I supposed is that the task is being executed multiple times.

    I know, why you don't cancel it when the game stop?
    That's because I'm using the same task in 10 different rooms, and if I cancel task object, I supposed that it will cancel all.

    Also I try to save the object on a array when I start the game and cancel this object when the game get stopped, but it didn't work! The error was exactly the same...

    Anybody know what I can do? :(
    Last edited: Jan 5, 2016
  2. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Do you use classes? If yes, is it something like this?
    Match.php
    Timer.php

    In Match.php:
    PHP:
    $timer = new Timer();
    Now just cancel the $timer when the game ends in the same class.
    AndrewBit likes this.
  3. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    The best way was reset the timer, not cancel it (I solved the issue).
    Anyway, thanks.
    Legoboy0215 likes this.
  4. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Oh. I cancel it in my base :p

Share This Page

Advertisement