Solved SimpleForm Player List

Discussion in 'Help' started by NutXzG, Jul 17, 2020.

  1. NutXzG

    NutXzG Slime

    Messages:
    91
    GitHub:
    NutXzG
    Hello, I need help for code FormAPI SimpleForm Player List, Thx for help me
     
  2. JviguyGamesYT

    JviguyGamesYT Baby Zombie

    Messages:
    109
    GitHub:
    jviguy
    Player List As In A DropDown Menu With All The Online Players Or?
     
  3. NutXzG

    NutXzG Slime

    Messages:
    91
    GitHub:
    NutXzG
    Ops Sorry, I don't have enough details is not DropDown i want SimpleForm Button
     
  4. JviguyGamesYT

    JviguyGamesYT Baby Zombie

    Messages:
    109
    GitHub:
    jviguy
    so just one button like a regular form or a button foreach online player
     
  5. NutXzG

    NutXzG Slime

    Messages:
    91
    GitHub:
    NutXzG
    foreach button
     
  6. JviguyGamesYT

    JviguyGamesYT Baby Zombie

    Messages:
    109
    GitHub:
    jviguy
    i have no idea on this one im too tired to really go digging sorry (digging for an answer)
     
  7. Diduhless

    Diduhless Baby Zombie

    Messages:
    176
    GitHub:
    Diduhless
    foreach all the online players then make a button for each one of them?
     
  8. NutXzG

    NutXzG Slime

    Messages:
    91
    GitHub:
    NutXzG
    Yes
     
  9. Diduhless

    Diduhless Baby Zombie

    Messages:
    176
    GitHub:
    Diduhless
    So, what's your problem?
     
  10. NutXzG

    NutXzG Slime

    Messages:
    91
    GitHub:
    NutXzG
    PHP:
    foreach($this->getServer()->getOnlinePlayers() as $po){
           
    $list $po->getName();
          }
          
    $token $this->getConfig()->get("token");
          
    $form = new SimpleForm(function (Player $p$data) use($list){
           
    var_dump($data[0]);
            if(
    $data === null){
             return 
    true;
            }
            switch (
    $data[0]){
             case 
    0:
          
            break;
            }
          });
          
    $form->setTitle("§b§l-§a=§6- §cReport §d-§e=§5-");
                
    $form->addButton($list);
          
    $form->sendToPlayer($p);
         }
    var dump send NULL
    idk get name click button
     
    Last edited: Jul 18, 2020
  11. NutXzG

    NutXzG Slime

    Messages:
    91
    GitHub:
    NutXzG
    Help me
     
  12. Diduhless

    Diduhless Baby Zombie

    Messages:
    176
    GitHub:
    Diduhless
    Use a translator so we can communicate properly, thanks
    PHP:
    $onlinePlayers Server::getInstance()->getOnlinePlayers();
    $form = new SimpleForm(function(Player $player, ?int $result) use ($onlinePlayers) {
        if(
    $result === null) return;

        if(isset(
    $onlinePlayers[$result])) {
            
    $buttonPlayer $onlinePlayers[$result];
            
    // Do whatever with him
        
    }
    });

    foreach(
    $onlinePlayers as $onlinePlayer) {
        
    $form->addButton($onlinePlayer->getName());
    }
    Hope it works.
     
  13. NutXzG

    NutXzG Slime

    Messages:
    91
    GitHub:
    NutXzG
    Thx
     
    Diduhless likes this.
  14. GodWeedZao

    GodWeedZao Zombie

    Messages:
    246
    GitHub:
    godweedzao
    just look at EasyTp plugin source. :p
     

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.