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

Fly code not found

Discussion in 'Facepalm' started by JUZEXMOD, May 25, 2017.

  1. JUZEXMOD

    JUZEXMOD Spider

    Messages:
    8
    GitHub:
    DevolperPHP
    this code not found :
    PHP:
    $p->setAllowFlight(true);
    The code was enable but player can't fly
    i need a fly code please
    Thx
     
  2. Jose Antonio

    Jose Antonio Spider

    Messages:
    13
    1. Check $p is defined
    e.g. $event->getPlayer();
    2. Show us all the code
     
  3. [deleted]

    [deleted] Guest

    As said above, please provide the full Code.
    PHP:
    // Make sure $Player is definied to the Player object
    $player->setAllowFlight(TRUE);
    Have you imported the Player object?
     
  4. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    You do not need to use a class unless you are creating an object, using it for identifying arguments/parameters, etc. You do NOT necessarily need to use pocketmine\Player to do $player->function as long as you get the Player object from somewhere.
     
  5. [deleted]

    [deleted] Guest

    Correct. But, for example in this case:
    PHP:
    public function seFlying(Player $Player)
    {
      
    $player->setAllowFlight(TRUE);
    }
    He would need to import the class.
     
  6. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    In that case, he also would have received an error from PocketMine. Given that he didn't share any error, we can assume for now that he doesn't need to use it.
     
  7. [deleted]

    [deleted] Guest

    Please, first read (; (no offense)
    He said that the Code was not found. That could mean that the class was not found.
     
  8. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Could mean != Does mean. Unless you can read minds, you don't know what he meant. Simply guessing that he needed to use the class because of something else(That you guessed existed) in the plugin that isn't really relevant to the method he is using isn't helpful. I pointed this out because it is a common misconception that a use statement is always necessary, when it in fact is not.

    @JUZEXMOD, can you provide some information that could help your issue be resolved? An error, some context?
     
  9. [deleted]

    [deleted] Guest

    LOL. I don´t want to read minds, I just try to get what he means. Instead of getting Off-Topic now, try to help.
     
  10. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    You have a good point. I apologize. Preventing misleading information from being spread is helpful. Beyond that, nothing can be done but wait for OP to provide some information.
     
    Last edited: May 27, 2017
  11. PocketKiller

    PocketKiller Slime

    Messages:
    83
    GitHub:
    iPocket
    My god, both trying to be professional, don't flame fight.
     
  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.