WDYM so i need to put $event->getplayer()->getname(); ????? Or i need to send u how way i trigger the func?
[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); } } } }
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.
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.