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

Item count

Discussion in 'Help' started by Alex, Oct 24, 2017.

  1. Alex

    Alex Spider Jockey

    Messages:
    28
    GitHub:
    Bichwha
    public function confirmBuy($sender){

    $money = EconomyAPI::getInstance()->myMoney($sender);

    if($money > $this->paymentPrice){
    EconomyAPI::getInstance()->reduceMoney($sender->getName(), $this->paymentPrice, true);
    $sender->getInventory()->addItem(Item::get($this->itemId, $this->itemMeta, $this->itemCount, 1));
    $sender->sendMessage("You have bought " . $this->itemName);

    So my question is how do i give someone in their inventory an item with count beucase everytime i click on a simple form button it only gives me 1 item i need answer quick please
     
  2. VCraft

    VCraft Witch

    Messages:
    60
    GitHub:
    VCraftMCPE
    $item = new Item($id,$meta,$amount);
    $p->getInventory()->addItem($item); did that help?
     
  3. Az928

    Az928 Baby Zombie

    Messages:
    140
    GitHub:
    theaz928
    new Item($id, $meta, $count); doesn't return fully qualified "implemented" item class, there is a function known as Item::get($id, $meta, $count);
     
  4. VCraft

    VCraft Witch

    Messages:
    60
    GitHub:
    VCraftMCPE
    doesn't return fully qualified "implemented" item class... he didn't ask for that.
     
  5. Az928

    Az928 Baby Zombie

    Messages:
    140
    GitHub:
    theaz928
    Your function methods are totally wrong, just trying to help fixing that ;)
     
  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.