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

Ban Client

Discussion in 'Facepalm' started by AffanStarPure, Jun 29, 2017.

  1. AffanStarPure

    AffanStarPure Baby Zombie

    Messages:
    106
    GitHub:
    AffanStarPure
    PHP:
                    if(($player $this->getServer()->getPlayer($args[0])) instanceof Player) {
                        
    $name $player->getName();
                        
    $id $player->getUniqueId();
                        
    $banned $this->getConfig()->get("Banned", []);
                        
    $times $this->getConfig()->get("Times", []);
                        
    $banned[$name] = $cid;
                        
    $times[$cid] = -1;
                        
    $this->getConfig()->set("Banned"$banned);
                        
    $this->getConfig()->set("Times"$times);
                        
    $this->getConfig()->save();
                        
    $player->setBanned(true); //easy way to kick the player while giving a ban message
                        
    $sender->sendMessage($name." is now banned with the cid: ".$cid);
                    }else{
                        
    $sender->sendMessage("That player isn't online right now!"); 
    Code:
     2017-06-29 [12:57:23] [Server thread/CRITICAL]: Unhandled exception executing command 'bancid Affan' in bancid: Undefined variable: cid 2017-06-29 [12:57:23] [Server thread/CRITICAL]: ErrorException: "Undefined variable: cid" (EXCEPTION) in "/BanClientId-master/src/AffanStarPure/Main" at line 34 
    How i fix this getting error ban client
     
  2. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Read error! Variable $cid is not defined
     
  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.