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

Stone Drop help plugin error

Discussion in 'Plugin Help' started by Juqxi, Feb 15, 2017.

  1. Juqxi

    Juqxi Spider Jockey

    Messages:
    33
    Solved thanks for help
     
    Last edited: Feb 17, 2017
  2. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    getExp() is not a PM API function. also why are you passing a value to a get function.
     
    Juqxi and jasonwynn10 like this.
  3. Juqxi

    Juqxi Spider Jockey

    Messages:
    33
    Sorry but im dont know what u mean can u explain ?
     
  4. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    Juqxi likes this.
  5. Juqxi

    Juqxi Spider Jockey

    Messages:
    33
    $player->sendMessage("§7• >drOP:trafiłeś na rudę złota§b(+40xp)");
    $player->getInventory()->addItem(Item::get(14, 0, 1));
    $this->attributeMap->getAttribute(Attribute::EXPERIENCE)->getValue(40); }
    should work ?
     
  6. Juqxi

    Juqxi Spider Jockey

    Messages:
    33
    pls describe it in a code
     
  7. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    Just do
    PHP:
    /** @var $player Player */
    $player->setXpProgress($player->getXpProgress()+40);
     
    Juqxi likes this.
  8. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Also, please use code blocks:
    [PHP]put php code here[/PHP] or [CODE]put normal code here[/CODE]
     
  9. Juqxi

    Juqxi Spider Jockey

    Messages:
    33
    i added that and seems error:
    [Server thread/CRITICAL]: InvalidArgumentException: "Value 20 exceeds the range!" (EXCEPTION) in "/src/pocketmine/entity/Attribute" at line 175
    Btw: Its still dont sending me messages for example i drop diamond and i see Chat are sized up but i dont see message , and what i started seen too im not droped all items what i want to drop is me have error in percentage chance of drop ?
     
  10. Juqxi

    Juqxi Spider Jockey

    Messages:
    33
    Corrected
     
    jasonwynn10 and HimbeersaftLP like this.
  11. Juqxi

    Juqxi Spider Jockey

    Messages:
    33
    Should i add mt_rand to each single block for example
    PHP:
    public function onBreak(BlockBreakEvent $e){
            
    $player $e->getPlayer();
            
    $block $e->getBlock();
            
    $gracz $e->getPlayer()->getName();
            
    $drop mt_rand(1,1000);
    if(
    $e->getBlock()->getId() == 1) {
            switch(
    $drop){
            if(
    $drop <= 50/* it means 5% chance to do it ? for example 5% to drop id 2 from stone*/
            
    $player->getInventory()->addItem(Item::get(200));
    break;    
            if(
    $drop <= 500/* it means 50% chance to do it ? for example 50% to drop id 3 from stone */
            
    $player->getInventory()->addItem(Item::get(300));
         




       } 
     }
    }
     
  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.