How to unset fly sorry i am bad eng PHP: public function canFly(Player $player){ return $player->getAllowFlight(); } public function setFlying(Player $player, $mode){ $this->getServer()->getPluginManager()->callEvent($ev = new PlayerFlyModeChangeEvent($this, $player, $mode)); if($ev->isCancelled()){ return false; } $player->setAllowFlight($ev->willFly()); return true; } public function switchCanFly(Player $player){ $this->players[$player->getName()] = $player->getName(); $this->setFlying($player, !$this->canFly($player), true); } public function unswitchCanFly(Player $player){ unset($this->players[$player->getName()]); $this->setFlying($player, !$this->canFly($player), false); }
PHP: $player->setAllowFlight($ev->willFly());// What is that!?!?// Just use true or false instead of $ev->willFly().. Please learn PHP, basically the whole code is wrong.
You don't have to tell us that you have bad English every single time that you make a thread. Also, please learn PHP and the PocketMine API.
Its funny bc he always says this to everyone maybe start giving a link Anyways this should get you on the tight track http://docs.pocketmine.net/files.html
I can give you a link to learn PHP in 15 min and your functions are Invalid. here's the function list: Function list
He never said this was an event handler. It can be a simple function. Please combine your posts and stop posting consecutive posts. There is an edit button.