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

Command button?

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

  1. XiXaFia

    XiXaFia Spider Jockey

    Messages:
    26
    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:
    598
    GitHub:
    GamakCZ
    Not enough code
     
  3. XiXaFia

    XiXaFia Spider Jockey

    Messages:
    26
    Whuut??
     
  4. XiXaFia

    XiXaFia Spider Jockey

    Messages:
    26
    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:
    26
     
  6. GamakCZ

    GamakCZ Zombie Pigman

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

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

    XiXaFia Spider Jockey

    Messages:
    26
    I'll try, thank you in advance
     
  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.