2 Questions: Undefined property and one hit weapons.

Discussion in 'Development' started by WEATHERCRAFTYT1, Jun 30, 2020 at 9:53 PM.

  1. WEATHERCRAFTYT1

    WEATHERCRAFTYT1 Silverfish

    Messages:
    18
    So I was making this scoreboard for this plugin but when scoreboards load it gives me this

    Error: Undefined property : Murder\MM\Main::$score
    This is the php where the crash occur


    Code:
    if(strpos($pla->getNameTag(), "§b") !== false)
                                                                        {
                                                                      
                                                                        }
                                                                    }
                                                                    foreach($playersArena as $pla)
                                                                    {
                                                                                                                                         if(strpos($pla->getNameTag(), "§3") !== false)
                                                                        {
                                         $api = $this->plugin->score;
                                                                         $api->new($pla, $pla->getName(), TE::BOLD.TE::YELLOW."MURDER MYSTERY");
                                                                            
                                                                         $i = 0;
                                                                         $lines = [
                                                                         TE::WHITE."   ",
                                                                         TE::WHITE."Murders: ".TE::GREEN.$ase,
                                                                         TE::WHITE."Detectives: ".TE::GREEN.$det,
                                                                         TE::WHITE."Innocents: ".TE::GREEN.$ino,
                                                                         TE::WHITE."   ",
                                                                         TE::WHITE."Map: ".TE::GREEN.$level,
                                                                         TE::WHITE."    ",
                                                                         TE::WHITE."Time: ".TE::GREEN.$time,
                                                                         TE::WHITE."   ",
                                                                         TE::WHITE."wcserver.goandplay.fun ",
                                                                         ];
                                                                         foreach($lines as $line){
                                                                          if($i < 15){
                                                                          $i++;
                                                                           $api->setLine($pla, $i, $line);
                                                                          }
                                                                         }
                                                                        //  $pla->sendTip(TE::RED."Bestia:" . $bestia .TE::AQUA. " Runner:" . $corredor.TE::YELLOW." Dist.Bestia:".TE::LIGHT_PURPLE.$dist.TE::YELLOW." Tiempo: ".TE::GREEN.$time. TE::RESET);
                                                                       }
                                                                       else
                                       {
                                                                          $api = $this->plugin->score;
                                                                         $api->new($pla, $pla->getName(), TE::BOLD.TE::YELLOW."MURDER MYSTERY");
                                                                         $i = 0;
                                                                         $lines = [
                                                                         TE::WHITE."   ",
                                                                         TE::WHITE."Murders: ".TE::GREEN.$ase,
                                                                         TE::WHITE."Detectives: ".TE::GREEN.$det,
                                                                         TE::WHITE."Innocents: ".TE::GREEN.$ino,
                                                                         TE::WHITE."   ",
                                                                         TE::WHITE."Map: ".TE::GREEN.$level,
                                                                         TE::WHITE."    ",
                                                                         TE::WHITE."Time: ".TE::GREEN.$time,
                                                                         TE::WHITE."   ",
                                                                         TE::WHITE."wcserver.goandplay.fun ",
                                                                         ];
                                                                         foreach($lines as $line){
                                                                          if($i < 15){
                                                                          $i++;
                                                                             $api->setLine($pla, $i, $line);
                                                                          }
                                                                        }    
    And my other question is one hit swords and one hit bows. What code can I use to do that.


    PHP:
                             foreach($playersArena as $pl)
                                                                            {
                                                                                if(
    strpos($pl->getNameTag(), "§b") !== false)
                                                                            {
                                                                                
    $item Item::get(Item::DIAMOND_SWORD01);
                    
    $item Item::get(Item::DIAMOND_SWORD01);
                    
    $pl->setNameTag("§b");
                    
    $pl->getInventory()->setItem(1$item);
                    
    $pl->getInventory()->setItem(0Item::get(Item::BREAD01));
                    
    $pl->getInventory()->setItem(2Item::get(Item::CLOCK01));
                    
    $pl->addTitle("§cYOU ARE THE MURDERER");
                    }
                    }
                    }
                                                                            
                                                                            
                                                                     if(
    $timeToStart<=0)
                                                                {
                                                                  foreach(
    $playersArena as $pl)
                                                                            {
                                                                                if(
    strpos($pl->getNameTag(), "§3") !== false)
                                                                            {
                                                                                
    $item Item::get(Item::BOW01);
                    
    $pl->getInventory()->setItem(1$item);
                    
    $pl->setNameTag("§3");
                    
    $pl->getInventory()->setItem(0Item::get(Item::ARROW064));
                    
    $pl->addTitle("§bYOU ARE THE DECETIVE");
                    }
                    }
                    }
     
  2. Secretsilver313

    Secretsilver313 Silverfish

    Messages:
    17
    GitHub:
    secretsilver
  3. WEATHERCRAFTYT1

    WEATHERCRAFTYT1 Silverfish

    Messages:
    18
    What code can I use to set the sharpness of the plugin. For example how can I set it
    PHP:
    foreach($playersArena as $pl)
                                                                            {
                                                                                if(
    strpos($pl->getNameTag(), "§b") !== false)
                                                                            {
                                                                                
    $item Item::get(Item::DIAMOND_SWORD01);
                    
    $item Item::get(Item::DIAMOND_SWORD01);
                    
    $pl->setNameTag("§b");
                    
    $pl->getInventory()->setItem(1$item);
                    
    $pl->getInventory()->setItem(0Item::get(Item::BREAD01));
                    
    $pl->getInventory()->setItem(2Item::get(Item::CLOCK01));
                    
    $pl->addTitle("§cYOU ARE THE MURDERER");
                    }
                    }
                    }
                                                                           
                                                                           
                                                                     if(
    $timeToStart<=0)
                                                                {
                                                                  foreach(
    $playersArena as $pl)
                                                                            {
                                                                                if(
    strpos($pl->getNameTag(), "§3") !== false)
                                                                            {
                                                                                
    $item Item::get(Item::BOW01);
                    
    $pl->getInventory()->setItem(1$item);
                    
    $pl->setNameTag("§3");
                    
    $pl->getInventory()->setItem(0Item::get(Item::ARROW064));
                    
    $pl->addTitle("§bYOU ARE THE DECETIVE");
                    }
                    }
                    }
     
  4. Secretsilver313

    Secretsilver313 Silverfish

    Messages:
    17
    GitHub:
    secretsilver
    The link I sent tells you how to do that :)
     
  5. WEATHERCRAFTYT1

    WEATHERCRAFTYT1 Silverfish

    Messages:
    18
  6. WEATHERCRAFTYT1

    WEATHERCRAFTYT1 Silverfish

    Messages:
    18

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.