Item Count

Discussion in 'Development' started by Pqoster, Sep 5, 2020.

  1. Pqoster

    Pqoster Spider Jockey

    Messages:
    28
    How do I get how many pots were left when the player died?
     
  2. TamerZ

    TamerZ Spider Jockey

    Messages:
    28
    GitHub:
    tamerkun-cuy
    OKAY. first of all, you literally post the same THREAD 3 TIMES.

    You'll get answers don't worry. But this is not gonna work.

    Instead you got an answer, you got a warn.
     
    Diduhless likes this.
  3. Pqoster

    Pqoster Spider Jockey

    Messages:
    28
    Sorry it was a bug.
    can you help me yes or no?
     
  4. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
  5. Pqoster

    Pqoster Spider Jockey

    Messages:
    28
  6. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    Use Inventory->getContents() to get all the items from the inventory, then just check if any of them are potions with a simple loop.
     
    Pqoster likes this.
  7. Pqoster

    Pqoster Spider Jockey

    Messages:
    28
  8. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
     
  9. xLeakDev Enzo

    xLeakDev Enzo Spider Jockey

    Messages:
    38
    GitHub:
    nya-enzo
    I know this dosen't really help but, i will show u how this Friday, so ya know
     
  10. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    foreach(Inventory->getContents() as $item){}
     
  11. xLeakDev Enzo

    xLeakDev Enzo Spider Jockey

    Messages:
    38
    GitHub:
    nya-enzo
    Sorry for late,

    PHP:
    foreach($player->getInventory()->getContents as $item){
        if(
    $item->getId() === /*id of potion*/ and $item->getDamage() === /*meta of potion*/){
            
    //do ur code ect..
        
    }
    }
    Im really, really not sure this works, im phone, im bored ect... i just thinked something and ye, just test it and tell me if it works
     
  12. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    Test it by yourself wtf
     
  13. xLeakDev Enzo

    xLeakDev Enzo Spider Jockey

    Messages:
    38
    GitHub:
    nya-enzo
    i cant, im on phone lmaoo
     

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.