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

setItem() Error

Discussion in 'Development' started by #A6543, Dec 22, 2016.

  1. #A6543

    #A6543 Zombie

    Messages:
    267
    Hi,
    I tried to set an item to the killers inventory (onDeath). That works. But if the killer has something in his hand, it doesn't replaces.

    Code:
    PHP:
    killer->getInventory()->clearAll();
    $killer->getInventory()->setItem(0Item::get(27101));
     
  2. InspectorGadget

    InspectorGadget Zombie Pigman

    Messages:
    462
    GitHub:
    InspectorGadget
    PHP:
    $killer->getInventory()->setItemInHand(Item::get(27101));
     
  3. #A6543

    #A6543 Zombie

    Messages:
    267
    It doesn't work
     
  4. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    PHP:
    $inventory->addItem($item);
    $inventory->setHeldItemIndex($inventory->first($item));
     
  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.