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

Help getItemInHand error code

Discussion in 'Development' started by MrGalletaYTPM, Jan 5, 2020.

  1. MrGalletaYTPM

    MrGalletaYTPM Spider

    Messages:
    9
    Can you help me with this code, I get an error on line 63 is the following code
    The error marks me in the code of
    $mao = $player->getItemInHand();
    Is it well written?

    public function onMenu(PlayerInteractEvent $e){
    $player = $e->getPlayer();
    $mao = $player->getItemInHand();
     
  2. alvin0319

    alvin0319 Creeper

    Messages:
    5
    GitHub:
    alvin0319
    give me error
     
  3. Zach1603

    Zach1603 Spider Jockey

    Messages:
    27
    GitHub:
    zedstar16
    lol the error is obvious
    You can’t access getItemInHand() from the player object,
    you need to use
    $player->getInventory()->getItemInHand();
     
    jasonwynn10 likes this.
  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.