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

Inventory clearing

Discussion in 'Development' started by Hipster, Oct 26, 2017.

  1. Hipster

    Hipster Zombie

    Messages:
    214
    How to clear total inventory of player? Even the item on crafting inventory and player cursor inventory?
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Cursor inventory:
    $player->getCursorInventory()

    Player inventory:
    $player->getInventory()

    Use inventory->clearAll() to clear the inventory.
     
  3. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    PlayerCursorInventory doesn't have a clearAll() function
     
  4. Hipster

    Hipster Zombie

    Messages:
    214
    it extends base inventory which does have that function, please learn OOP or read the docs. it's
    PHP:
    $player->getCursorInventory()->clearAll();
     
  5. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    OI don't assume I don't know how to program simply from a single post. I just didn't look at the parent class
     
    EdwardHamHam likes this.
  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.