Why admin chat doesn't work?

Discussion in 'Plugin Help' started by Duvewo, Jan 14, 2019.

  1. Duvewo

    Duvewo Spider

    Messages:
    6
    GitHub:
    loneliplay
    PHP file
    PHP:
    if($c->getName() == "a"){
            if(
    $group == "admin" || $s->isOp(true)){
                if(
    count($args) == 1){
                foreach(
    $this->getServer()->getOnlinePlayers() as $pidori){
                    if(
    $pidori $group == "admin"){
                        
    $pidori->sendMessage("§7" .$s->getName(). ": " .$args[0]);
                    }
                }
                }
            }
        }
     
  2. corytortoise

    corytortoise Skeleton

    Messages:
    843
    GitHub:
    corytortoise
    $pidori appears to be a player object, but you compare it to strings in your if statements.

    This isn't nearly enough code. I assume this is in an event handler, but I don't know what event. I don't know what $c, $s, or $group are. Please also explain whether an error is shown in console, or if part of the code works as intended, but not all of it.
     
  3. Duvewo

    Duvewo Spider

    Messages:
    6
    GitHub:
    loneliplay
    This is onCommand function where $s means CommandSender, $c Command, and $group = $this->cfg->getNested($s->getName().".group")
     

Share This Page

  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.