Just store player names and stats in arrays and then display them sorted. I'd reccommend to use this function for sorting.
If you need help developing a plugin please send us your code (also in the future use the Development section)
_____________ <?php namespace statistic; use pocketmine\Player; use pocketmine\Server; use pocketmine\math\Vector3; use pocketmine\level\Level; use pocketmine\scheduler\Task; use pocketmine\scheduler\ServerScheduler; use pocketmine\plugin\PluginBase; use pocketmine\level\Position; use statistic\Main; use pocketmine\entity\Effect; use pocketmine\entity\EffectInstance; use pocketmine\utils\Config; use pocketmine\item\Item; use pocketmine\item\enchantment\Enchantment; use pocketmine\item\enchantment\EnchantmentInstance; use onebone\economyapi\EconomyAPI; use pocketmine\inventory\Inventory; use pocketmine\level\particle\FloatingTextParticle; class LeadTask extends Task { public $plugin; public function __construct(Main $plugin, Player $player) { $this->plugin = $plugin; $this->player = $player; } public function onRun(int $currentTick){ $player = $this->player; $x = $this->getConfig()->get("x"); $y = $this->getConfig()->get("y"); $z = $this->getConfig()->get("z"); $name = $player->getName(); $money = $this->eco->myMoney($player); $online = $this->getServer->getOnlinePlayers(); $message = " §bYour Money: §c{$money} "; $message1 = " §bOnline Players: §c{$online} "; $lead = " §c{$name}'s §aStatistic "; $lead1 = " §c{$name}'s §aStatistic "; $p = new FloatingTextParticle(new Vector3($x, $y, $z), $message,$message1, $lead); $player->getLevel()->addParticle($p); } }
There were so many mistakes in this, I can't mention every single change, please just see for yourself: PHP: <?phpnamespace statistic;use onebone\economyapi\EconomyAPI;use pocketmine\level\particle\FloatingTextParticle;use pocketmine\math\Vector3;use pocketmine\Player;use pocketmine\scheduler\Task;use statistic\Main;class LeadTask extends Task { private $plugin; private $player; private $eco; public function __construct(Main $plugin, Player $player) { $this->plugin = $plugin; $this->player = $player; $this->eco = EconomyAPI::getInstance(); } public function onRun(int $currentTick) { $player = $this->player; $x = $this->plugin->getConfig()->get("x"); $y = $this->plugin->getConfig()->get("y"); $z = $this->plugin->getConfig()->get("z"); $name = $player->getName(); $money = $this->eco->myMoney($player); $online = count($this->plugin->getServer()->getOnlinePlayers()); $title = "§bYour Money: §c{$money}"; $message = "§bOnline Players: §c{$online}\n"; $message .= "§c{$name}'s §aStatistic\n"; $message .= "§c{$name}'s §aStatistic"; $p = new FloatingTextParticle(new Vector3($x, $y, $z), $message, $title); $player->getLevel()->addParticle($p, [$player]); }} Why didn't you show us the error it shows in the console? Also in the future use the "+" button to add a code block, it makes code more readable in the forums.