1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

op

Discussion in 'Facepalm' started by DogTheBlock, May 29, 2017.

  1. DogTheBlock

    DogTheBlock Spider Jockey

    Messages:
    29
    how can i op specific players using setOp()? , thanks
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Use setOp() without any parameters.
     
  3. DogTheBlock

    DogTheBlock Spider Jockey

    Messages:
    29
    PHP:
    public function trustedPlayers(Player $player){
             
    $ops[TB] = "Teamblocket";
             
    $ops[jay] = "Jayson5145";
             
    $ops[candy] = "xXCandyManXx";
             
    $ops[project] = "Proj3ctGoldYT";
                 
    $player->setOp($ops);
    will this work?
     
  4. XdmingXD

    XdmingXD Baby Zombie

    Messages:
    158
    GitHub:
    xdmingxd
    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();
    }
    }
     
    Last edited: May 30, 2017
  5. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    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);
        }
    }
     
  6. DogTheBlock

    DogTheBlock Spider Jockey

    Messages:
    29
    thanks <3 still learning work in progress
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.