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

How would I create a plugin where players inventroy would be clear when they leave

Discussion in 'General discussion' started by Zarooz, Dec 31, 2019.

  1. Zarooz

    Zarooz Spider

    Messages:
    10
    I originally had my plugin set to join event but now some plugins that give players items will be removed. How can I get a code to remove players inventory when they leave? Any ideas?
     
  2. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
    Clear All Inventory Player?
     
  3. Zarooz

    Zarooz Spider

    Messages:
    10
    Yes, but when a player disconnects
     
  4. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
    Uh, I think code is work
    PHP:
    use pocketmine\event\player\PlayerQuitEvent;
    public function 
    onQuit(PlayerQuitEvent $e){
    $p $e->getPlayer();
    $p->getInventory()->clearAll();
    }
     
  5. Zarooz

    Zarooz Spider

    Messages:
    10
    yep perfectly thanks!
     
  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.