Alright So i have been thinking about making my own plugin but i need help if anyone knows how make a command named /Cake and it would turn you to /Gamemode $[username] creative if you can Send it to me on Skype minecraftisthebest4
This is really easy to do actually! I'll send it to you on these forums instead of Skype, just in case you aren't online
PHP: <?php/*__PocketMine Plugin__name=Cakeversion=author=class=Cakeapiversion=10,11,12*/class Cake implements Plugin{private $api;public function __construct(ServerAPI = $api, $server = false)$this->api = $api;}public function init(){$this->api->console->register("cake", " ", array($this, "cmdHandler"));}public function __destruct(){}public function cmdHandler($cmd, $args, $issuer){switch($cmd){case "cake":$this->api->console->run("gamemode c " . $issuer);break;}}}
You don't need to make a switch function for that at all...I sent him the plugin but I made a typo on mine, so I have to fix that
BeastBajan it says Parse error: syntax error, unexpected '=', expecting '&' or variable (T_VARIABLE) in C:\Users\abrad1212▒▒\Desktop\PocketMine\PocketMine-MP\plugins\Cake.php on line 13 any way to fix
Heres the fix version: PHP: <?php/*__PocketMine Plugin__name=Cakeversion=author=class=Cakeapiversion=10,11,12*/class Cake implements Plugin{private $api;public function __construct(ServerAPI $api, $server = false)$this->api = $api;}public function init(){$this->api->console->register("cake", " ", array($this, "cmdHandler"));}public function __destruct(){}public function cmdHandler($cmd, $args, $issuer){switch($cmd){case "cake":$this->api->console->run("gamemode c " . $issuer);break;}}}
Here is my version ... Code: <?php/* __PocketMine Plugin__ name=Cake version= author= class=Cake apiversion=10,11,12 */ class Cake implements Plugin{ private $api; } public function __construct(ServerAPI = $api, $server = false){ $this->api = $api; } public function init(){ $this->api->console->register("cake", " ", array($this, "cake")); } public function cake($cmd, $args, $issuer){ $this->api->console->run("gamemode creative $issuer"); } public function __destruct(){ }