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

I don't know Why do code

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

  1. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
    Code:
    PHP:
    public function createmoney(Player $p){
       
    $config = new Config($this->getDataFolder() . "config.yml"Config::YAML);
       
    $form = new CustomForm(function (Player $p$data null){
        if(
    $data === null){
         return 
    true;
        }
        
    $amount $data[2]*$data[3];
        
    $money $this->eco->myMoney($p);
        if(
    $data[1] === null){
        if(
    $money >= $amount)
            {
                
    $this->eco->reduceMoney($p$amount);
          
    $this->getLogger()->info("Connect this function");
         
    $money $data[2]*$data[3];
         
    $rand mt_rand(099999);
          
    $code md5($rand);
          
    $giftcnf->set($code);
          
    $gift->setNested($code ".type""money");
          
    $giftcnf->setNested($code ".data", [
           
    "amount" => $money
           
    ]);
           
    $giftcnf->setNested($code ".use", []);
           
    $giftcnf->save($p$code);
          
    $this->showcode($p);
        }else{
       
    $p->sendMessage($config->getNested("language.nomoney"));
          }
        }else{
                if(
    $money >= $amount)
            {
                
    $this->eco->reduceMoney($p$amount);
          
    $this->getLogger()->info("Connect this function");
         
    $money $data[2]*$data[3];
          
    $giftcnf->set($code);
          
    $gift->setNested($code ".type""money");
          
    $giftcnf->setNested($code ".data", [
           
    "amount" => $Money
           
    ]);
           
    $giftcnf->setNested($code ".use", []);
           
    $giftcnf->save($p$code);
          
    $this->showcode($p);
        }else{
       
    $p->sendMessage($config->getNested("language.nomoney"));
          }
        }
       });
       
    $form->setTitle($config->getNested("language.formtitlecreatemoney"));
       
    $form->addLabel($config->getNested("language.formlabelcreatemoney"));
       
    $form->addInput($config->getNested("language.formoneycreatemoney"));
       
    $form->addInput($config->getNested("language.formamountcreatemoney"));
       
    $form->addInput($config->getNested("language.formcountcreatemoney"));
       
    $form->sendToPlayer ($p);
      }
    I set my money 9999999 and i set input(2) 3 and input (3) 2
    but no send anything
     
  2. Primus

    Primus Zombie Pigman

    Messages:
    749
    Just dump the $data variable using var_dump, you'll see the contents. Learn to debug!
     
  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.