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

Solved Error when i type a custom command

Discussion in 'Plugin Help' started by Kayllon, Jan 13, 2021.

  1. Kayllon

    Kayllon Silverfish

    Messages:
    24
    How i can solve this error ?
    I will put my main.php
    im brazillian, so i making my plugin in portuguese
    Screenshot_20210113-033251.png Screenshot_20210113-033930.png
     
  2. Primus

    Primus Zombie Pigman

    Messages:
    749
    This one is easy, every variable should be defined somewhere. Can you find where $cmd is?

    Rename $cmd to $command, because that is what you get in the method parameters!
     
  3. Kayllon

    Kayllon Silverfish

    Messages:
    24
    Hm ok i will try
     
  4. J1don2x

    J1don2x Creeper

    Messages:
    1
    The problem is just, you defined Command as $command in the function parameters and you switched $cmd which is a undefined variable! To fix it, you'll have to switch $command->getName() instead.
     
  5. Primus

    Primus Zombie Pigman

    Messages:
    749
    Anyone else want to paraphrase it?
     
  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.