Ui Error

Discussion in 'Development' started by Muhammed0232, Jul 4, 2019.

  1. Muhammed0232

    Muhammed0232 Silverfish

    Messages:
    19
    GitHub:
    Muhammed0232
    Error: Open Ss


    Codes
    PHP:
    public function mainForm($player){
            
    $form = new SimpleForm(function (Player $s, array $data){
       
    $player $s->getPlayer();
       
    $result $data[0];
            switch(
    $result){
     
    // codes

    }
    });
    // codes
    }
     

    Attached Files:

  2. wolfdale

    wolfdale Zombie

    Messages:
    373
    You shouldnt type hint the second argument as it might be null, which leads to another error
    Also, SimpleForm returns the index of the button that is clicked, which is a int
    CustomForm is the one that returns an array
     
    HimbeersaftLP and Muqsit like this.
  3. Muhammed0232

    Muhammed0232 Silverfish

    Messages:
    19
    GitHub:
    Muhammed0232
    How To Fix İ Dont Understand
     
  4. wolfdale

    wolfdale Zombie

    Messages:
    373
    If you want a form that only has buttons simply change to
    PHP:
    $form = new SimpleForm(function (Player $player$data){
       
    //no need to getPlayer() from a Player object, it is already a player!
       
    if($data !== null){ // $data is int or null
          
    switch($data){
          }
       }
    });
     

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.