I dont know if i cant, but i have one attempt Spoiler <?php namespace Core; use pocketmine\scheduler\PluginTask; use Core\Core; use pocketmine\Player; use pocketmine\utils\TextFormat as C; class ParticleTask extends PluginTask { private $plugin; private $playergg = []; public function __construct(Core $plugin) { $this->plugin = $plugin; parent::__construct($plugin); } public function getPlayer(Player $p) { $this->playergg[$p->toString] = $p; } public function onRun($currentTick) { foreach ($this->playergg as $p) { $this->testPlayer($p); $this->plugin->getServer()->broadcastMessage("It work"); } } } oops bad section
Wtf i dont understand what is (name) how i define it?? Spoiler <?php namespace Core; use pocketmine\scheduler\PluginTask; use Core\Core; use pocketmine\Player; use pocketmine\utils\TextFormat as C; class ParticleTask extends PluginTask { private $plugin; private $playergg = []; public function __construct(Core $plugin) { $this->plugin = $plugin; parent::__construct($plugin); } public function getServer() { return $this->plugin->getServer(); } public function onRun($currentTick) { $p2 = $this->getServer()->getPlayer(); $name = $p->getName(); $p = $this->getServer()->getPlayer($name); $this->testPlayer($p); } }
Here, Make sure to Define Player when Scheduling the task Code: <?php namespace Core; use pocketmine\scheduler\PluginTask; use Core\Core; use pocketmine\Player; use pocketmine\utils\TextFormat as C; class ParticleTask extends PluginTask { private $plugin; public function __construct(Core $plugin, $player) { $this->plugin = $plugin; $this->player = $player; parent::__construct($plugin); } public function onRun($currentTick) { //$this->testPlayer($p); IDK WHAT THIS IS SUPPOSE TO DO $this->player->sendMessage("Hi"); $this->plugin->getServer()->broadcastMessage("It work"); } } }