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

Wont display

Discussion in 'Development' started by Remarkabless, Jan 13, 2018.

  1. Remarkabless

    Remarkabless Slime

    Messages:
    83
    GitHub:
    Remakem
    Can Anyone help me? I have never used var_dump. I know about the function but I dont know where to place it in my code.

    Someone told me to update $this->orange with var_dump but I honestly just dont know how ive researched the function and tried multiple ways please help heres my code:


    PHP:
    <?php

    namespace Test;

    use 
    pocketmine\event\Listener;
    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\event\player\PlayerInteractEvent;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\Server;
    use 
    pocketmine\Player;

    class 
    Main extends PluginBase implements Listener{

    public 
    $orange = [];

    public 
    $blue = [];

    public 
    $red = [];

        public function 
    onEnable() {
            
    $this->getServer()->getPluginManager()->registerEvents($this$this);
        }

        public function 
    onJoin(PlayerJoinEvent $event) {
        
    $orange $this->orange;
        
    $player $event->getPlayer();
        
    $uuid $player->getUniqueId();
        
    $playerCount count($this->getServer()->getOnlinePlayers());
            if (
    $playerCount <= 1  ) {
                
    $orange[] = $uuid;
            }
        }
       
        public function 
    onInteract(PlayerInteractEvent $event) {
            
    $player $event->getPlayer();
            
    $uuid $player->getUniqueId();
            
    $orange $this->orange;
            if (
    $event->getItem()->getId() == 1) {
                if (
    in_array($uuid$orange)) {
                    
    $player->sendMessage("Hey!");
                   
                }else {
                    
    $player->sendMessage("L");
                }
            }
        }
    }

    Basically, I dont know where to add the var_dump()

    In my code thanks.
     
  2. kazuya

    kazuya Slime

    Messages:
    79
    GitHub:
    xdqrknez
    var_dump($this->orange); ?
     
  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.