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

FormAPI doesn’t execute

Discussion in 'Development' started by xXNiceAssassinlo YT, Mar 5, 2018.

  1. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    Code:
    PHP:
                $api $this->plugin->getServer()->getPluginManager()->getPlugin("FormAPI");
                
    $form $api->createSimpleForm(function (Player $player$data){
                    
    $result $data[0];
                    if(
    $result === null){
                    }
                    switch(
    $result[0]){
                        case 
    1:
                        
    $player->sendMessage("test");
                        break;
                    }
                });

                
    $form->setTitle("Test SOCKK");
                
    $form->addButton("Butt"1);
                
    $form->sendToPlayer($player);
     
  2. Alex

    Alex Spider Jockey

    Messages:
    28
    GitHub:
    Bichwha
    PHP:

        
    function onCommand(CommandSender $senderCommand $cmdstring $label, array $args):
            
    bool
                
    {
                switch (
    $cmd->getName())
                    {
                case 
    "buycraftui":
                    if (
    $sender instanceof Player)
                        {
                        
    $api $this->getServer()->getPluginManager()->getPlugin("FormAPI");
                        if (
    $api === null || $api->isDisabled())
                            {
                            }

                        
    $form $api->createSimpleForm(
                        function (
    Player $sender, array $data)
                            {
                            
    $result $data[0];
                            if (
    $result === null)
                                {
                                }

                            switch (
    $result)
                                {
                            case 
    0:
                                break;

                            case 
    1:
                                
    $this->cashForm($sender);
                                break;
                                }
                            });
                        
    $form->setTitle(TextFormat::BOLD "buycraft");
                        
    $form->setContent("Your cart: " TextFormat::GOLD $cart);
                        
    $form->addButton("");
                        
    $form->addButton(TextFormat::BOLD "cash' );
                        
    $form->sendToPlayer($sender);
                        }
                      else
                        {
                        
    $sender->sendMessage(TextFormat::RED . "Use this Command in-game.");
                        return true;
                        }

                    break;
                    }

                return true;
                }
    This is my code xd
     
  3. AshBull

    AshBull Spider Jockey

    Messages:
    31
    PHP:
    $form->addButton(TextFormat::BOLD "cash' );
    Hmm...
     
    dktapps likes this.
  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.