so after merging herobrine scare and troll plugin together,(i will give them both high credits) I recieved a error when adding my own command.heres the script. <?php /* * __PocketMine Plugin__ * name=Troll * description=Troll people * version=1.0 * author=Legomite * class=Troll * apiversion=10 */ class Troll implements Plugin{ private $api; public function __construct(ServerAPI $api, $server = false){ $this->api = $api; } public function init(){ $this->api->console->register("troll","Troll someone. Usage: /troll <playername>", array($this, "troll")); $this->api->console->register("hb", "This command summons Herobrine", array($this, "handleCommand")); $this->api->console->register("hbscare", "It scare people saying something!", array($this, "handleCommand")); $this->api->console->register("spook", "Scare theperson of your choice!", array($this, "handleCommand")); } public function troll($cmd, $args, $issuer, $target){ $target = $args[0]; $username = $issuer->username; $this->api->console->run("tp ".$target." 20 300 20"); $this->api->chat->sendTo(false, "You have been trolled by ".$username, $target); $this->api->chat->sendTo(false, "You have trolled ".$target, $username); } public function __destruct(){} public function handleCommand($cmd, $args, $issuer, $alias){ switch($cmd){ case "hb": $this->api->chat->broadcast("Herobrine has joined the game");/*Modify me!*/ $this->api->chat->broadcast(": I AM HERE. I AM WATCHING. ALWAYS.");/*Modify me!*/ break; case "hbscare": $user = strtolower($args[0]); $this->api->chat->broadcast(": I will find you. Better watch your back.");/*Modify me!*/ break; } public function __destruct(){} public function handleCommand($cmd, $args, $issuer, $alias){ switch($cmd){ case "spook": $target = $args[0]; $username = $issuer->username; $this->api->chat->sendTo(false, "You have spooked".$target $username); $this->api->chat->sendTo(false, "YOU WILL PAY TO WHAT YOU HAVE DONE TO ME!!!".$username, $target); } } ?>
You have two handleCommand functions. You need to group them by adding a case to the switch in the first function.
Use this quote from above. And Code: public function __destruct(){} public function handleCommand($cmd, $args, $issuer, $alias){ switch($cmd){ case "hb": $this->api->chat->broadcast("Herobrine has joined the game");/*Modify me!*/ $this->api->chat->broadcast(": I AM HERE. I AM WATCHING. ALWAYS.");/*Modify me!*/ break; case "hbscare": $user = strtolower($args[0]); $this->api->chat->broadcast(": I will find you. Better watch your back.");/*Modify me!*/ break; } has two brackets at the beginning of __destruct()