Hi, PHP: <?phpnamespace test;use pocketmine\Server;use pocketmine\Player;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\event\player\PlayerJoinEvent;use pocketmine\utils\Config;class main extends PluginBase implements Listener { public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); @mkdir($this->getDataFolder() . "players/"); $this->getServer()->getLogger()->info("[test] Enabled"); } public function onDisable() { $this->getServer()->getLogger()->info("[test] Disabled"); } public function playerJoinEvent(PlayerJoinEvent $event) { $player = $event->getPlayer(); $this->config = new Config($this->getDataFolder() . "players/" . strtolower($player->getName()), Config::YAML, array( "ruleaccepted" => false )); $this->config; if ($this->config->get("ruleaccepted") == false) { $this->formOnJoin($player); } } public function formOnJoin($player) { $api = $this->getServer()->getPluginManager()->getPlugin("FormAPI"); $form = $api->createSimpleForm(function (Player $player, int $data = null) { $result = $data; if($result === null) { $this->formOnJoin($player); return true; } switch($result) { case 0: $this->config->set("ruleaccepted", true); $this->config->save(); $player->sendMessage("Thank you for accepting the rules."); break; case 1: $player->kick("\nYou have not agreed to the rules."); break; } }); $form->setTitle("Welcome and Rules"); $form->setContent("RULES"); $form->addButton("I accept\nAnd do not show this again."); $form->addButton("I disagree"); $form->sendToPlayer($player); return $form; }}?> Whenever I join from my main account and then from my alt, and click on disagree (on my alt), and accept (on my main account), it only sets "ruleaccepted" to true for my alt and not for my main's. Is there a way to fix this? Thanks.
PHP: $this->config->set("ruleaccepted", true); This part and all the related part to this are misunderstooded... It got used by all players... I will help you latter ^^ sorry for bad grammar
Helpful tip! Add code blocks between your code to make it look neater. Eg (Type it without the space in front of PHP: [ PHP] Code… [ /PHP] Or click the + sign intop of the chat box, and click code.
Here is the updated code: PHP: <?phpnamespace test;use pocketmine\Server;use pocketmine\Player;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\event\player\PlayerJoinEvent;use pocketmine\utils\Config;class main extends PluginBase implements Listener { public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); @mkdir($this->getDataFolder() . "players/"); $this->getServer()->getLogger()->info("[test] Enabled"); } public function onDisable() { $this->getServer()->getLogger()->info("[test] Disabled"); } public function playerJoinEvent(PlayerJoinEvent $event) { $player = $event->getPlayer(); $this->config = new Config($this->getDataFolder() . "players/" . strtolower($player->getName()), Config::YAML, array( "ruleaccepted" => false )); $this->config; if ($this->config->get("ruleaccepted") == false) { $this->formOnJoin($player, $this->config); } } public function formOnJoin($player, $config) { $api = $this->getServer()->getPluginManager()->getPlugin("FormAPI"); $form = $api->createSimpleForm(function (Player $player, int $data = null) use ($config) { $result = $data; if($result === null) { $this->formOnJoin($player, $config); return true; } switch($result) { case 0: $config->set("ruleaccepted", true); $config->save(); $player->sendMessage("Thank you for accepting the rules."); break; case 1: $player->kick("\nYou have not agreed to the rules."); break; } }); $form->setTitle("Welcome and Rules"); $form->setContent("RULES"); $form->addButton("I accept\nAnd do not show this again."); $form->addButton("I disagree"); $form->sendToPlayer($player); return $form; }}?> Thanks to: lıu = sıɥʇ JJJJJJJJe/\ for helping me to fix.