Why it does not work?

Discussion in 'Development' started by Pqoster, Aug 28, 2020.

  1. Pqoster

    Pqoster Spider Jockey

    Messages:
    28
    Why it does not work?
    when the player executes "/ cps on" starts the task
    when you run "/ cps off" it cancels the task
    Can someone help me please?

    - Sorry for my bad English
    PHP:
          public $cps false;
                     
    // MAIN
                  
    case "cps":
                if(!isset(
    $args[0])){
                    if (
    $sender instanceof Player) {
        
    $sender->sendMessage("§e§lUSO: §r§e/cps§7 <on/off>");
       
             } else {
    $sender->sendMessage("§cUse o comando dentro do jogo!");
    }
             } else {

                    if(
    $args[0] == "on"){
    $this->getScheduler()->scheduleRepeatingTask(new BMsg($this$sender), 1);
                        
    $sender->sendMessage("§e§lMOD: §r§eCPS ativado com sucesso!");
                    
    $this->cps true;

                } elseif (
    $args[0] == "off"){
                        
    $sender->sendMessage("§e§lMOD: §r§eCPS desligado com sucesso!");    
                     
    $this->cps false;
          }        
        } 
    PHP:
     // TASK
        
    public function onRun(int $currentTick)
        {  
            
    $cps $this->plugin->getClicks($this->player);
             
    $this->player->sendTip("§eCPS:§7 {$cps}");        
         if(
    $this->plugin->cps false){
        
    $this->plugin->getScheduler()->cancelTask($this->getTaskId());
    }
    }
    }
     
  2. aminozomty

    aminozomty Silverfish

    Messages:
    19
    GitHub:
    aminozomty
    What's the error ?
     

Share This Page

  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.