Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Function in pocketmine not producing results :setCount()

Comments in 'Plugin Development' started by args, Sep 5, 2014.

  1. args
    Offline

    args New Member

    Joined:
    Jun 14, 2014
    Posts:
    47
    Minecraft User:
    args
    Code:
                    $e->getPlayer()->setHealth($e->getPlayer()->getHealth()+1);
                    Server::getInstance()->broadcastMessage($e->getPlayer()->getInventory()->getItemInHand()->getCount()." gold");
                    $e->getPlayer()->getInventory()->getItemInHand()->setCount($e->getPlayer()->getInventory()->getItemInHand()->getCount()-1);
                    Server::getInstance()->broadcastMessage($e->getPlayer()->getInventory()->getItemInHand()->getCount()." gold");
    
    Is this function not available or am i using it wrong?
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    What is happening? The value doesn't change?
  3. args
    Offline

    args New Member

    Joined:
    Jun 14, 2014
    Posts:
    47
    Minecraft User:
    args
    Yeah, the player is holding 11 gold,
    it should set the 11 to 11-1 but instead it is still 11.

    Maybe the inventory is changed but not updating...
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Right. $player->getInventory()->sendContents($player) try again.

Share This Page

Advertisement