Help me please, i dev help menu ui, when you click on the button in the menu, the information is displayed in the chat, I need it to be displayed in the form ui and there was a "back button" information, how to do it PHP: <?php/*HelpmeUI gemacht von SaveConnectionPE für alle!*/namespace Helpme;use pocketmine\Server;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\utils\TextFormat as TF;use pocketmine\Player;use pocketmine\command\{Command, CommandSender, CommandExecutor, ConsoleCommandSender};class Main extends PluginBase implements Listener{ public $prefix = "§9§lПОМОЩЬ §8§l»§r §7"; public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info(TF::GREEN . "Плагин активирован."); @mkdir($this->getDataFolder()); $this->saveDefaultConfig(); $this->getResource("config.yml"); } public function onDisable(){ $this->getLogger()->info(TF::RED . "Плагин деактивирован."); } public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args) : bool{ switch($cmd->getName()){ case "helpme": if($sender->hasPermission("helpme.use")){ $this->helpmeMain($sender); }else{ $sender->sendMessage($this->prefix . "§cУ вас нет прав§4!§r"); return true; } break; } return true; } public function helpmeMain($sender){ $api = $this->getServer()->getPluginManager()->getPlugin("FormAPI"); $form = $api->createSimpleForm(function (Player $sender, int $data = null){ $result = $data; if($result === null){ return true; } switch($result){ case 0: $sender->sendMessage($this->prefix . $this->getConfig()->get("helpme.msg1")); break; case 1: $sender->sendMessage($this->prefix . $this->getConfig()->get("helpme.msg2")); break; case 2: $sender->sendMessage($this->prefix . $this->getConfig()->get("helpme.msg3")); break; case 3: $sender->sendMessage($this->prefix . $this->getConfig()->get("helpme.msg4")); break; case 4: $sender->sendMessage($this->prefix . $this->getConfig()->get("helpme.msg5")); break; case 5: $sender->sendMessage($this->prefix . $this->getConfig()->get("helpme.msg6")); break; case 6: $sender->sendMessage($this->prefix . $this->getConfig()->get("helpme.msg7")); break; case 7: $sender->sendMessage($this->prefix . $this->getConfig()->get("helpme.msg8")); break; case 8: $sender->sendMessage($this->prefix . $this->getConfig()->get("helpme.msg9")); break; } }); $form->setTitle($this->getConfig()->get("helpme.title")); $form->setContent($this->getConfig()->get("helpme.content")); $form->addButton($this->getConfig()->get("helpme.button1")); $form->addButton($this->getConfig()->get("helpme.button2")); $form->addButton($this->getConfig()->get("helpme.button3")); $form->addButton($this->getConfig()->get("helpme.button4")); $form->addButton($this->getConfig()->get("helpme.button5")); $form->addButton($this->getConfig()->get("helpme.button6")); $form->addButton($this->getConfig()->get("helpme.button7")); $form->addButton($this->getConfig()->get("helpme.button8")); $form->addButton($this->getConfig()->get("helpme.button9")); $form->sendToPlayer($sender); return $form; }}
WARNING: Not tested code, please try it @WylSmart PHP: <?php/*HelpmeUI gemacht von SaveConnectionPE für alle!*/namespace Helpme;use pocketmine\Server;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\utils\TextFormat as TF;use pocketmine\Player;use pocketmine\command\{Command, CommandSender, CommandExecutor, ConsoleCommandSender};use jojoe77777\FormAPI\SimpleForm; //Form apiclass Main extends PluginBase implements Listener{ public $prefix = "§9§lПОМОЩЬ §8§l»§r §7"; public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info(TF::GREEN . "Плагин активирован."); @mkdir($this->getDataFolder()); $this->saveDefaultConfig(); $this->getResource("config.yml"); } public function onDisable(){ $this->getLogger()->info(TF::RED . "Плагин деактивирован."); } public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args) : bool{ switch($cmd->getName()){ case "helpme": if($sender->hasPermission("helpme.use")){ $this->helpmeMain($sender); }else{ $sender->sendMessage($this->prefix . "§cУ вас нет прав§4!§r"); return true; } break; } return true; } public function helpmeMain($sender){ $form = new SimpleForm(function (Player $sender, int $data = null){ $result = $data; if($result === null){ return true; } switch($result){ case 0: $this->helpmeText($sender, $this->prefix . $this->getConfig()->get("helpme.msg1")); break; case 1: $this->helpmeText($sender, $this->prefix . $this->getConfig()->get("helpme.msg2")); break; case 2: $this->helpmeText($sender, $this->prefix . $this->getConfig()->get("helpme.msg3")); break; case 3: $this->helpmeText($sender, $this->prefix . $this->getConfig()->get("helpme.msg4")); break; case 4: $this->helpmeText($sender, $this->prefix . $this->getConfig()->get("helpme.msg5")); break; case 5: $this->helpmeText($sender, $this->prefix . $this->getConfig()->get("helpme.msg6")); break; case 6: $this->helpmeText($sender, $this->prefix . $this->getConfig()->get("helpme.msg7")); break; case 7: $this->helpmeText($sender, $this->prefix . $this->getConfig()->get("helpme.msg8")); break; case 8: $this->helpmeText($sender, $this->prefix . $this->getConfig()->get("helpme.msg9")); break; } }); $form->setTitle($this->getConfig()->get("helpme.title")); $form->setContent($this->getConfig()->get("helpme.content")); $form->addButton($this->getConfig()->get("helpme.button1")); $form->addButton($this->getConfig()->get("helpme.button2")); $form->addButton($this->getConfig()->get("helpme.button3")); $form->addButton($this->getConfig()->get("helpme.button4")); $form->addButton($this->getConfig()->get("helpme.button5")); $form->addButton($this->getConfig()->get("helpme.button6")); $form->addButton($this->getConfig()->get("helpme.button7")); $form->addButton($this->getConfig()->get("helpme.button8")); $form->addButton($this->getConfig()->get("helpme.button9")); $form->sendToPlayer($sender); return $form; } public function helpmeText($sender, $text){ $form = new SimpleForm(function (Player $sender, int $data = null){ $result = $data; if($result === null){ return true; } switch($result){ case 0: $this->helpmeMain($sender); break; } }); $form->setTitle($this->getConfig()->get("helpme.title")); $form->setContent($text); $form->addButton("getback"); //YOUR BACK BUTTON $form->sendToPlayer($sender); return $form; }}
for example, I have in each content a button “how to buy donate” when I go to this button it does not disappear but settles down, how do I make the “how to buy donate” button disappear? since she is in her content!
Screenshot https://ibb.co/0GHNNh2 https://ibb.co/zQkxdv4 https://ibb.co/d7dJZJd moving to the red “how to buy donut” category inside the content, the button should disappear, but it does not disappear “the last picture”
I see. which part of the code is the latest menu? because is pretty hard for me to understand it with your language
1. Home menu category: https://ibb.co/0GHNNh2 2. Content HelpmeText > helpme.msg1 inside the content added a button "how to donate" and "button back" when I switch to "how to donate" button no hide, I need the button in its category to disappear... PHP: <?php/*HelpmeUI gemacht von SaveConnectionPE für alle!*/namespace Donate;use pocketmine\Server;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\utils\TextFormat as TF;use pocketmine\Player;use pocketmine\command\{Command, CommandSender, CommandExecutor, ConsoleCommandSender};use jojoe77777\FormAPI\SimpleForm; //Form apiclass Main extends PluginBase implements Listener{ public $prefix = "§9§lПОМОЩЬ §8§l»§r §7"; public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info(TF::GREEN . "Плагин активирован."); @mkdir($this->getDataFolder()); $this->saveDefaultConfig(); $this->getResource("config.yml"); } public function onDisable(){ $this->getLogger()->info(TF::RED . "Плагин деактивирован."); } public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args) : bool{ switch($cmd->getName()){ case "donate": if($sender->hasPermission("donate.use")){ $this->donateMain($sender); }else{ $sender->sendMessage($this->prefix . "§cУ вас нет прав§4!§r"); return true; } break; } return true; } public function DonateMain($sender){ $form = new SimpleForm(function (Player $sender, int $data = null){ $result = $data; if($result === null){ return true; } switch($result){ case 0: $this->donateText($sender, $this->prefix . $this->getConfig()->get("donate.msg1")); break; case 1: $this->donateText($sender, $this->prefix . $this->getConfig()->get("donate.msg2")); break; case 2: $this->donateText($sender, $this->prefix . $this->getConfig()->get("donate.msg3")); break; case 3: $this->donateText($sender, $this->prefix . $this->getConfig()->get("donate.msg4")); break; case 4: $this->donateText($sender, $this->prefix . $this->getConfig()->get("donate.msg5")); break; } }); $form->setTitle($this->getConfig()->get("donate.title")); $form->setContent($this->getConfig()->get("donate.content")); $form->addButton($this->getConfig()->get("donate.button1")); $form->addButton($this->getConfig()->get("donate.button2")); $form->addButton($this->getConfig()->get("donate.button3")); $form->addButton($this->getConfig()->get("donate.button4")); $form->addButton($this->getConfig()->get("donate.button5")); $form->sendToPlayer($sender); return $form; } public function donateText($sender, $text){ $form = new SimpleForm(function (Player $sender, int $data = null){ $result = $data; if($result === null){ return true; } switch($result){ case 0: $this->donateText($sender, $this->prefix . $this->getConfig()->get("donate.content.info")); break; case 1: $this->donateMain($sender); break; } }); $form->setTitle($this->getConfig()->get("donate.title")); $form->setContent($text); $form->addButton($this->getConfig()->get("donate.button.info")); $form->addButton($this->getConfig()->get("donate.button.back")); //YOUR BACK BUTTON $form->sendToPlayer($sender); return $form; }}
Simply add a string like this: PHP: <?php/*HelpmeUI gemacht von SaveConnectionPE für alle!*/namespace Donate;use pocketmine\Server;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\utils\TextFormat as TF;use pocketmine\Player;use pocketmine\command\{Command, CommandSender, CommandExecutor, ConsoleCommandSender};use jojoe77777\FormAPI\SimpleForm; //Form apiclass Main extends PluginBase implements Listener{ public $prefix = "§9§lПОМОЩЬ §8§l»§r §7"; public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getLogger()->info(TF::GREEN . "Плагин активирован."); @mkdir($this->getDataFolder()); $this->saveDefaultConfig(); $this->getResource("config.yml"); } public function onDisable(){ $this->getLogger()->info(TF::RED . "Плагин деактивирован."); } public function onCommand(CommandSender $sender, Command $cmd, string $label, array $args) : bool{ switch($cmd->getName()){ case "donate": if($sender->hasPermission("donate.use")){ $this->donateMain($sender); }else{ $sender->sendMessage($this->prefix . "§cУ вас нет прав§4!§r"); return true; } break; } return true; } public function DonateMain($sender){ $form = new SimpleForm(function (Player $sender, int $data = null){ $result = $data; if($result === null){ return true; } switch($result){ case 0: $this->donateText($sender, $this->prefix . $this->getConfig()->get("donate.msg1")); break; case 1: $this->donateText($sender, $this->prefix . $this->getConfig()->get("donate.msg2")); break; case 2: $this->donateText($sender, $this->prefix . $this->getConfig()->get("donate.msg3")); break; case 3: $this->donateText($sender, $this->prefix . $this->getConfig()->get("donate.msg4")); break; case 4: $this->donateText($sender, $this->prefix . $this->getConfig()->get("donate.msg5")); break; } }); $form->setTitle($this->getConfig()->get("donate.title")); $form->setContent($this->getConfig()->get("donate.content")); $form->addButton($this->getConfig()->get("donate.button1")); $form->addButton($this->getConfig()->get("donate.button2")); $form->addButton($this->getConfig()->get("donate.button3")); $form->addButton($this->getConfig()->get("donate.button4")); $form->addButton($this->getConfig()->get("donate.button5")); $form->sendToPlayer($sender); return $form; } public function donateText($sender, $text, $button = true){ $form = new SimpleForm(function (Player $sender, int $data = null){ $result = $data; if($result === null){ return true; } switch($result){ case 0: $this->donateText($sender, $this->prefix . $this->getConfig()->get("donate.content.info"), false); break; case 1: $this->donateMain($sender); break; } }); $form->setTitle($this->getConfig()->get("donate.title")); $form->setContent($text); if($button) $form->addButton($this->getConfig()->get("donate.button.info")); $form->addButton($this->getConfig()->get("donate.button.back")); //YOUR BACK BUTTON $form->sendToPlayer($sender); return $form; }}