Command button?

Discussion in 'Development' started by XiXaFia, Mar 24, 2020.

  1. XiXaFia

    XiXaFia Spider Jockey

    Messages:
    25
    how to add commands from this button
    Code:
    foreach($this->getServer()->getOnlinePlayers() as $online){
             $form->addButton($online->getName(), -1,"", $online->getName());
     
  2. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    439
    GitHub:
    GamakCZ
    Not enough code
     
  3. XiXaFia

    XiXaFia Spider Jockey

    Messages:
    25
    Whuut??
     
  4. XiXaFia

    XiXaFia Spider Jockey

    Messages:
    25
    Code:
    public function Menu($sender){
            $api = $this->getServer()->getPluginManager()->getPlugin("FormAPI");
            $form = $api->createSimpleForm(function (Player $sender, int $data = null) {
                $result = $data;
                if($result === null){
                    return true;
                }
                ???
             });
             $form->setTitle("§b>§eMenu§b<");
             $form->setContent("§b§oPilih §ePlayer :");
             foreach($this->getServer()->getOnlinePlayers() as $online){
             $form->addButton($online->getName(), -1,"", $online->getName());
                     }
                    $form->sendToPlayer($sender);
                    return $form;
        }
    }
     
  5. XiXaFia

    XiXaFia Spider Jockey

    Messages:
    25
     
  6. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    439
    GitHub:
    GamakCZ
    Server->dispatchCommand(Player, string $command);

    example:
    PHP:
    $player->getServer()->dispatchCommand($player"gamemode c");
     
  7. XiXaFia

    XiXaFia Spider Jockey

    Messages:
    25
    I'll try, thank you in advance
     

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.