PHP: public function trustedPlayers(Player $player){ $ops[TB] = "Teamblocket"; $ops[jay] = "Jayson5145"; $ops[candy] = "xXCandyManXx"; $ops[project] = "Proj3ctGoldYT"; $player->setOp($ops); will this work?
maybe PHP: public function trustedPlayers(Player $player){ $ops[TB] = "Teamblocket"; $ops[jay] = "Jayson5145"; $ops[candy] = "xXCandyManXx"; $ops[project] = "Proj3ctGoldYT"; foreach($ops as $player) { $player->setOp();}}
It wont. You are missing a bracket. You didn't define $ops but I think php is intelligent enough to assume it to be an array, but you'll be greeted with an isset() error. You'll get a "Call to a member function setOp() on string" error. PHP: public function trustedPlayers(){ $ops = [ "TB" => "Teamblocket", "jay" => "Jayson5145", "candy" => "xXCandyManXx", "project" => "Proj3ctGoldYT" ]; foreach($ops as $op){ Server::getInstance()->addOp($op); }}