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

Give items doesn't work

Discussion in 'Development' started by #A6543, Feb 11, 2017.

  1. #A6543

    #A6543 Zombie

    Messages:
    267
    I give a player items, when he killed someone. But only he item in the killers hand doesn't update. Does someone know why?
    My code:
    PHP:
    $killer->getInventory()->setItem(0$item);
    $killer->getInventory()->setItem(1$item);
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Send the full code.
     
  3. #A6543

    #A6543 Zombie

    Messages:
    267
    Do I need to send something to update the item in the killers hand?

    PHP:
    $killer->getInventory()->clearAll();
    $item Item::get(27101);
    $killer->getInventory()->setItem(0$item); 
    $killer->getInventory()->setItem(1$item);
     
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    If you want to, you can do that, tho your code must automatically do it.
    PHP:
    $player->getInventory()->sendSlot($slotnumber$player);
    Where $slotnumber is the slot number.
     
  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.