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

making join queue

Discussion in 'Plugin Help' started by zenqibruh, Sep 20, 2021.

  1. zenqibruh

    zenqibruh Spider Jockey

    Messages:
    36
    GitHub:
    ohitszenqi
    WDYM so i need to put $event->getplayer()->getname();
    ?????
    Or i need to send u how way i trigger the func? Screenshot_20210924-182719_Spck Editor.jpg
     
  2. Axon

    Axon Zombie

    Messages:
    276
    Show us your queuePlayer function
     
    Agent likes this.
  3. zenqibruh

    zenqibruh Spider Jockey

    Messages:
    36
    GitHub:
    ohitszenqi
     

    Attached Files:

  4. zenqibruh

    zenqibruh Spider Jockey

    Messages:
    36
    GitHub:
    ohitszenqi
    Yo :(
     
  5. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Show me the code where you call the function
     
    Agent likes this.
  6. zenqibruh

    zenqibruh Spider Jockey

    Messages:
    36
    GitHub:
    ohitszenqi
    Screenshot_20210924-204245_Spck Editor.jpg
    If you're asking if where do i got player variable i put
    $player = $event->getPlayer();
     
  7. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    var_dump($this->queue[]) and show me what it outputs in console
     
    Agent likes this.
  8. zenqibruh

    zenqibruh Spider Jockey

    Messages:
    36
    GitHub:
    ohitszenqi
    Where? In everywhere???
     
  9. zenqibruh

    zenqibruh Spider Jockey

    Messages:
    36
    GitHub:
    ohitszenqi
    Screenshot_20210924-213318_Spck Editor.jpg Screenshot_20210924-213141_PocketMine-MP.jpg
     
  10. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Paste your current code here
     
  11. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Agent likes this.
  12. zenqibruh

    zenqibruh Spider Jockey

    Messages:
    36
    GitHub:
    ohitszenqi
    Wdym?

    So i put
    case: 0
    queueplayer()
    break;
    function queuePlayer() {
    Code blah blah
    }
     
  13. zenqibruh

    zenqibruh Spider Jockey

    Messages:
    36
    GitHub:
    ohitszenqi
    [QOUTE="Kyd, post: 80250, member: 597"]Paste your current code here[/QUOTE]
    Code:
    ;
      public function onEnable() {
          $this->getLogger()->info("wtf");
          $this->getServer()->getPluginManager()->registerEvents($this, $this);
      }
      public function onJoined(PlayerJoinEvent $event) {
        $player = $event->getPlayer();
        $slot5 = item::get(264, 0, 1);
        $slot5->setCustomName("bruh what");
        $player->getInventory()->clearAll();
        $player->getInventory()->setItem(4, $slot5);
      }
      public function queuePlayer(string $playername) : void {
                          if(empty(var_dump($this->queued[]))) { # If no one's in the queue
                                $this->queued[] = $playername; # Set the player to the queue
                                 return;
                          } # If someone is already in the queue
                          $codeToStartTheGame; # Start the game
                          unset($this->queued); # Clears the queue
                          return;
                    }
      public function playerscount() {
        $bruh = count($this->queued[]);
        return $bruh;
      }
      public function onInteract(PlayerInteractEvent $event) {
        $player = $event->getPlayer();
        $item = $event->getPlayer();
        $name = $player->getName();
        $itemname = $player->getInventory()->getItemInHand()->getName();
        if ($itemname === "Random Tags") {
          $player->sendmessage("§5You've got the gay tag!");
          $player->setDisplayName("[§5Gay§r] {$name}");
          $items = Item::get(264, 0, 1);
          $player->getInventory()->removeItem($items);
          return true;
        }
        if ($itemname === "bruh what") {
          $api = $this->getServer()->getPluginManager()->getPlugin("FormAPI");
          $form = $api->createSimpleForm(function (Player $player, int $data = null){
          $result = $data;
           if($result === null){
              return true;
          }
       
                  // On Button Click
                  # $player instance of Player object
            # Queues the player with the above function
           switch($result){
            case 0:
              $this->queuePlayer($player->getName());
            $counters = $this->playerscount();
             $player->sendmessage("Players are: {$counters}");
            break;
          }
    }); 
          $form->setTitle("§5tenkyu por da hapiyest dei in ma laif");
          $form->setContent("Kaqong");
          $form->addButton("try");
          $form->sendToPlayer($player);
          $player->sendmessage("gay");
          return true;
        }
      }
      public function onBreak(BlockBreakEvent $event) {
       if($event->getBlock()->getId() === 1) {
        $random = mt_rand(1, 100);
         if($random <= 20) {
          $player = $event->getPlayer();
          $name = $player->getName();
          $player->sendmessage("[§6zenqi§r] §6{$name} §rgot a random tag while mining!");
          $drops = array();
          $itembruh = item::get(131, 0, 1);
          $itembruh->setCustomName("Random Tags");
          $drops[] = $itembruh;
          $event->setDrops($drops);
         }
        }
      }
    }
     
  14. zenqibruh

    zenqibruh Spider Jockey

    Messages:
    36
    GitHub:
    ohitszenqi
    Yo bro
     
  15. zenqibruh

    zenqibruh Spider Jockey

    Messages:
    36
    GitHub:
    ohitszenqi
    Oh! It was working now... but if i clicked it
    second time it wouldn't work.
    Screenshot_20210925-135316_Spck Editor.jpg Screenshot_20210925-135306_PocketMine-MP.jpg
     
  16. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Read the error. Looks like you have not defined the property "queued" in your class.
    PHP:
    public $queued = array();
    Next time posting code format it first and use the [ php ] tag to make it easier for us to help.
     
  17. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    The code you suggested was already in my previous "spoonfeed" in this thread
    I've been trying to help him with his issues, but he keeps on changing everything I tell him to do and just goes off on his own.
     
    Agent, Axon and Kyd like this.
  18. Axon

    Axon Zombie

    Messages:
    276
    I got an idea, why don’t he upload his plug-in on GitHub then we just fix it for him :p
     
    Agent and minijaham like this.
  19. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Sounds like a good idea!
     
    Agent and Axon like this.
  20. Axon

    Axon Zombie

    Messages:
    276
    Perhaps we should also show how to do it :p xd
     
    Agent likes this.
  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.