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

Solved How to pickup item, but actually dont pickup

Discussion in 'Development' started by Yexeed, Oct 17, 2017.

  1. Yexeed

    Yexeed Slime

    Messages:
    76
    So, im trying to make something like this: player pickups the bricks, his score increases, but bricks should not appear in his inventory, and bricks should disappear from the world.

    Solution:
    PHP:
    public function onPick(InventoryPickupItemEvent $e){
          
    $p $e->getHolder();
          if(
    $e->getItem()->getItem()->getId() == 336){
            
    $e->setCancelled();
            
    $p->sendMessage("You picked up the brick");
            
    $e->getItem()->close();
            }
          }
     
    Last edited: Oct 17, 2017
  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.