Hello Guys, im trying to make a new plugin, but as im learning more advanced things, i was wondering how can i make a points system, like if a player kills another player, he gets a point, but i want to make a command that like gets the points in total of the player and it sends to the $sender the point count. i think i need a Player.yml file, but i never worked in that before, can you help me?? thanks?? like here: If player executes "/myscore" tab should appear like here: oh, and like, to make a tab where the players with most points appear (obviously executing a command). like to appear like this: If player executes "/best" tab should appear like here: If you have a video tutorial or something like that, please share ill be very grateful, thanks!!!!!!!!!!! KEEP IN MIND THAT IM NOT ASKING YOU TO MAKE THE FULL PLUGIN FOR ME, THANKS FOR UNDERSTANDING.
Ummmm, i really didnt understand, i tried to implement the code, but the problem is that it says that the "if" has a problem, and like, the command to get the list???
You will need to create a playerfile inside of a players folder for each player that joins. To create the folder: PHP: public function onEnable() { @mkdir($this->getDataFolder() . "Players/");} To create the playerfiles: PHP: public function onJoin(PlayerJoinEvent $event) { $player = $event->getPlayer(); $this->player = new Config($this->getDataFolder() . "Players/" . strtolower($player->getName()), Config::YAML, array( "points" => 0));$this->player;} And you can give a player a point when they die like: PHP: $points = $this->player->get("points");$this->player->set("points", $points + 1);$this->player->save();
like this? PHP: public function onJoin(PlayerJoinEvent $event) { $player = $event->getPlayer(); $this->player = new Config($this->getDataFolder() . "Players/" . strtolower($player->getName()), Config::YAML, array( "points" => 0)); $this->player; $points = $this->player->get("points");$ $this->player->set("points", $points + 1);$ $this->player->save(); }
Learn PHP. It is just a simple syntax error that you should be able to fix yourself. Actually, you don't even need to know PHP to fix it, if you have a functional usable cerebrum.