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

Need Developer Help

Discussion in 'Development' started by Potatoe, Nov 14, 2017.

  1. Potatoe

    Potatoe Creeper

    Messages:
    2
    GitHub:
    potatoetrainyt
    Hey People Of The Forums, Im Working On A Core For My Server And I Am Getting This Error When Executing A Command:

    17-11-14 [16:58:38] [Server thread/CRITICAL]: Unhandled exception executing command 'friend' in friend: Undefined offset: 0 2017-11-14 [16:58:38] [Server thread/CRITICAL]: ErrorException: "Undefined offset: 0" (EXCEPTION) in "BPECore/src/BPECore/System/FriendSystem" at line 25

    Code:

    [24] if($sender instanceof Player){
    [25] if($args[0] == null){
    [26] $sender->sendMessage("§7---< §6Friend Commands §7>---");

    I Don't Know How To Fix This But If Anyone Could Help I Would Appreciate It

     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Do you mean if(isset($args[0]))
     
  3. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    use:
    PHP:
     if(!isset($args[0])) 
    instead
    PHP:
     if($args[0] == null
     
  4. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    or
    PHP:
    if(empty($args[0]))
     
    DanielYTK likes this.
  5. Potatoe

    Potatoe Creeper

    Messages:
    2
    GitHub:
    potatoetrainyt
    ok tysm everyone! thanks for helping
     
  6. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Or just if(empty($args)). If $args[0] is not set, there is nothing in $args at all.
     
    Muqsit likes this.
  7. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    Please mark this topic as solved
     
  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.