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

Solved Dropdown PlayerList

Discussion in 'Development' started by Notjblus, May 26, 2020.

  1. Notjblus

    Notjblus Spider Jockey

    Messages:
    28
    GitHub:
    JblusItsMe
    PHP:
    private $PlayerList = [];
        
    /**
         * @param Player $sender
         */
        
    public function ReportPlayer(Player $sender) {
            
    $api $this->plugin->getServer()->getPluginManager()->getPlugin("FormAPI");

            if(
    $api == null || $api->isDisabled()) {
                return 
    true;
            }

            
    $list = [];
            foreach (
    $this->plugin->getServer()->getOnlinePlayers() as $p) {
                
    $list[] = $p->getName();
            }
            
    $this->PlayerList[$sender->getName()] = $list[]; // 79

            
    $form $api->createCustomForm(function(Player $sender$data) {
                
    $this->name $this->playerList[$sender->getName()][$data[0]];
                
    $this->raison $data[1];

                
    // code

                
    if($this->name instanceof Player) {
                   
    // code
                    
    if($sender->isOp()) {
                        
    $sender->sendMessagfe("§7[§dREPORT§7] Le joueur a bien été signalé.");
                    } else {  
                        
    $sender->sendMessage("§7[§dREPORT§7] Votre prochain report peut être effectué dans 2 minutes.");
                        
    $sender->sendMessage("§7[§dREPORT§7] Le joueur a bien été signalé.");
                    }
                } else {
                    
    $sender->sendMessage("§7[§dREPORT§7] Le joueur n'a pas été trouvé sur notre serveur.");
                }

            });
            
    $form->setTitle("§f- §dREPORT §f-");
            
    $form->addDropdown("Joueur"$this->PlayerList[$sender->getName()]);
            
    $form->addInput("Raison""Anti AFK");
            
    $form->sendToPlayer($sender);
        }
    He tells me I can't use [] after PlayerList on line 79
     
  2. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    Which line is line 79 :3?
     
  3. Notjblus

    Notjblus Spider Jockey

    Messages:
    28
    GitHub:
    JblusItsMe
    $this->PlayerList[$sender->getName()] = $list[];
     
  4. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    Will response next 6 hours (P/s: I have to go to my school)
     
  5. Mohagames205

    Mohagames205 Spider Jockey

    Messages:
    26
    GitHub:
    mohagames205
    Hi!
    PHP:
    //this is correct
    $this->PlayerList[$sender->getName()] = $list;

    //this is incorrect PHP syntax
    $this->PlayerList[$sender->getName()] = $list[]; 
     
  6. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
     
  7. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    It's true
     
  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.