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

Undifined offset: 2 help

Discussion in 'Plugin Help' started by Mochi, Jun 4, 2020.

  1. Mochi

    Mochi Baby Zombie

    Messages:
    113
    Error: Undefined offset: 2
    File: plugins/API/src/API/Main
    Line: 258
    Type: ErrorException

    THIS CRASH WAS CAUSED BY A PLUGIN
    BAD PLUGIN: API v0.1


    Code:
    PHP:
        public function topWins() {

     
    $stats $this->db->query("SELECT * FROM `players` ORDER BY `wins` DESC LIMIT 0, 10");
     
    $list "";

      foreach(
    $this->getServer()->getDefaultLevel()->getPlayers() as $p) {
     while (
    $element $stats->fetchArray(SQLITE3_ASSOC))
     
    $list .= $element['name'] . " ";
     
    //var_dump($list);
     
    $name explode(" "$list);
     
    $nick1 $sql $this->db->query("SELECT * FROM `players` WHERE `name` = '$name[0]'")->fetchArray(SQLITE3_ASSOC)['wins'];
     
    $nick2 $sql $this->db->query("SELECT * FROM `players` WHERE `name` = '$name[1]'")->fetchArray(SQLITE3_ASSOC)['wins'];
     
    $nick3 $sql $this->db->query("SELECT * FROM `players` WHERE `name` = '$name[2]'")->fetchArray(SQLITE3_ASSOC)['wins'];
     
    $nick4 $sql $this->db->query("SELECT * FROM `players` WHERE `name` = '$name[3]'")->fetchArray(SQLITE3_ASSOC)['wins'];
     
    $nick5 $sql $this->db->query("SELECT * FROM `players` WHERE `name` = '$name[4]'")->fetchArray(SQLITE3_ASSOC)['wins'];
     
    $nick6 $sql $this->db->query("SELECT * FROM `players` WHERE `name` = '$name[5]'")->fetchArray(SQLITE3_ASSOC)['wins'];
     
    $nick7 $sql $this->db->query("SELECT * FROM `players` WHERE `name` = '$name[6]'")->fetchArray(SQLITE3_ASSOC)['wins'];
     
    $nick8 $sql $this->db->query("SELECT * FROM `players` WHERE `name` = '$name[7]'")->fetchArray(SQLITE3_ASSOC)['wins'];
     
    $nick9 $sql $this->db->query("SELECT * FROM `players` WHERE `name` = '$name[8]'")->fetchArray(SQLITE3_ASSOC)['wins'];
     
    $nick10 $sql $this->db->query("SELECT * FROM `players` WHERE `name` = '$name[9]'")->fetchArray(SQLITE3_ASSOC)['wins'];
     
    $this->wins1->setTitle("§e1. §r§7" $name[0] . "§7 - §e" $nick1 "§r");
    $this->getServer()->getDefaultLevel()->addParticle($this->wins1, [$p]);
    // $this->top1->setTitle("§e1. §r§a" . $name[0] . "§7 - §e" . $nick1 . "§r");
     //$this->getServer()->getDefaultLevel()->addParticle($this->top1, [$p]);
     
    $this->wins2->setTitle("§e2. §r§7" $name[1] . "§7 - §e" $nick2 "§r");
     
    $this->getServer()->getDefaultLevel()->addParticle($this->wins2, [$p]);
    //$this->top2->setTitle("§e2. §r§b" . $name[1] . "§7 - §e" . $nick2 . "§r");
     //$this->getServer()->getDefaultLevel()->addParticle($this->top2, [$p]);
     
    $this->wins3->setTitle("§e3. §r§7" $name[2] . "§7 - §e" $nick3 "§r");
     
    $this->getServer()->getDefaultLevel()->addParticle($this->wins3, [$p]);
    // $this->top3->setTitle("§e3. §r§6" . $name[2] . "§7 - §e" . $nick3 . "§r");
    // $this->getServer()->getDefaultLevel()->addParticle($this->top3, [$p]);
     
    $this->wins4->setTitle("§e4. §r§7" $name[3] . "§7 - §e" $nick4 "§r");
     
    $this->getServer()->getDefaultLevel()->addParticle($this->wins4, [$p]);
     
    $this->wins5->setTitle("§e5. §r§7" $name[4] . "§7 - §e" $nick5 "§r");
     
    $this->getServer()->getDefaultLevel()->addParticle($this->wins5, [$p]);
     
    $this->wins6->setTitle("§e6. §r§7" $name[5] . "§7 - §e" $nick6 "§r");
    $this->getServer()->getDefaultLevel()->addParticle($this->wins6, [$p]);
    // $this->top1->setTitle("§e1. §r§a" . $name[0] . "§7 - §e" . $nick1 . "§r");
     //$this->getServer()->getDefaultLevel()->addParticle($this->top1, [$p]);
     
    $this->wins7->setTitle("§e7. §r§7" $name[6] . "§7 - §e" $nick7 "§r");
     
    $this->getServer()->getDefaultLevel()->addParticle($this->wins7, [$p]);
    //$this->top2->setTitle("§e2. §r§b" . $name[1] . "§7 - §e" . $nick2 . "§r");
     //$this->getServer()->getDefaultLevel()->addParticle($this->top2, [$p]);
     
    $this->wins8->setTitle("§e8. §r§7" $name[7] . "§7 - §e" $nick8 "§r");
     
    $this->getServer()->getDefaultLevel()->addParticle($this->wins8, [$p]);
    // $this->top3->setTitle("§e3. §r§6" . $name[2] . "§7 - §e" . $nick3 . "§r");
    // $this->getServer()->getDefaultLevel()->addParticle($this->top3, [$p]);
     
    $this->wins9->setTitle("§e9. §r§7" $name[8] . "§7 - §e" $nick9 "§r");
     
    $this->getServer()->getDefaultLevel()->addParticle($this->wins9, [$p]);
     
    $this->wins10->setTitle("§e10. §r§7" $name[9] . "§7 - §e" $nick10 "§r");
     
    $this->getServer()->getDefaultLevel()->addParticle($this->wins10, [$p]);
     
    $this->toptext->setTitle("§7Ranked mode");
     
    $this->getServer()->getDefaultLevel()->addParticle($this->toptext, [$p]);
     
    $this->toptext1->setTitle("§bRanked rating");
     
    $this->getServer()->getDefaultLevel()->addParticle($this->toptext1, [$p]);
     
    $this->toptext2->setTitle("§6Click to find out more.!");
     
    $this->getServer()->getDefaultLevel()->addParticle($this->toptext2, [$p]);
      }
     }
     
  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.