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

How to check if argument is in config

Discussion in 'Development' started by Levi, Jun 7, 2018.

  1. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    config:
    PHP:
    kits:
       
    starter:
           
    items276:0:1
       star
    :
           
    items299:0:1
    how do i check if args[0](lets say 'starter') is under kits?
     
  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    check if config kits is set starter
     
  3. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    If $getConfig() == $args[0]?
     
  4. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    isset($config["kits"][$args[0]])
     
    Levi likes this.
  5. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    PHP:
    [Server thread/CRITICAL]: Unhandled exception executing command 'warp ccc' in warpCannot use object of type pocketmine\utils\Config as array
    [
    18:04:45] [Server thread/CRITICAL]: Error"Cannot use object of type pocketmine\utils\Config as array" (EXCEPTIONin "test/src/gay/command/warp/Command" at line 36
    PHP:
    if(isset($this->core->config["Warps"][$args[0]])){
                        
    $sender->sendMessage("in config");
                    }else{
                        
    $sender->sendMessage("not in config");
                    }
     
  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.