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

Clear inventory when changing gamemode

Discussion in 'Help' started by Destroyer57, Oct 3, 2018.

  1. Destroyer57

    Destroyer57 Zombie

    Messages:
    275
    How to clear the inventory when someone changes its gamemode. Please no php codes i cant code in php. Is there any plugin for that?
     
    XenialDan likes this.
  2. Lolipop78709

    Lolipop78709 Creeper

    Messages:
    5
    Search 'TeaSpoon'
     
  3. Destroyer57

    Destroyer57 Zombie

    Messages:
    275
    Doesnt work
     
  4. CupidonSauce173

    CupidonSauce173 Zombie

    Messages:
    298
    GitHub:
    cupidonsauce173
    sorry
    PHP:
        public function onPlayerGameModeChangeEvent(PlayerGameModeChangeEvent $event){
            
    $event->getPlayer()->getInventory()->clearAll();
        }
    This is more for ppl who wants to do it x) I think it's the right way...not sure
    don't forget to
    PHP:
    use pocketmine\event\player\PlayerGameModeChangeEvent;
     
  5. Destroyer57

    Destroyer57 Zombie

    Messages:
    275
    I did that now it tells me it requires one of api 1.12.0 how to do that?
     
  6. CupidonSauce173

    CupidonSauce173 Zombie

    Messages:
    298
    GitHub:
    cupidonsauce173
    Change the api to 3.0.0 in plugin.yml
     
  7. Destroyer57

    Destroyer57 Zombie

    Messages:
    275
    Unhandled exception executing command
    'reload' in reload: syntax error, unexpected 'public function onPlayerGam
    e' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)
    [12:37:28] [Server thread/CRITICAL]: ParseError: "syntax error, unexpected
    'public function onPlayerGame' (T_STRING), expecting function (T_FUNCTION
    ) or const (T_CONST)" (EXCEPTION) in "Example.phar/src/Example/Example" at
    line 21
     
  8. Kkora

    Kkora Baby Zombie

    Messages:
    189
    GitHub:
    shisui203
    Find 'KeepInventory' on Google.com
    It's useful for you.
     
  9. Destroyer57

    Destroyer57 Zombie

    Messages:
    275
    Mhm.
     
  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.