Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Call to undefined method pocketmine\Player::addParticale()

Comments in 'Plugin Development' started by R7vmc, Aug 2, 2016.

  1. R7vmc
    Offline

    R7vmc New Member

    Joined:
    Aug 2, 2016
    Posts:
    22
    Minecraft User:
    R7vmc
    Hi There!
    i dont know what is the mistake in my code!
    PHP:
    $player->addParticale(new Vector3(HeartParticale($x$y$z)));
  2. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    $player->getLevel()->addParticle(...)
    You are adding a particle to the level not to the player
    SOFe, R7vmc and Potato like this.
  3. R7vmc
    Offline

    R7vmc New Member

    Joined:
    Aug 2, 2016
    Posts:
    22
    Minecraft User:
    R7vmc
    new error!
    Code:
    "Call to undefined method pocketmine\level\Level::addParticale()"
    Last edited: Aug 2, 2016
  4. R7vmc
    Offline

    R7vmc New Member

    Joined:
    Aug 2, 2016
    Posts:
    22
    Minecraft User:
    R7vmc
  5. R7vmc
    Offline

    R7vmc New Member

    Joined:
    Aug 2, 2016
    Posts:
    22
    Minecraft User:
    R7vmc
    @luca28pet ok i did it and i added "new" to Heart Particle
    PHP:
    $player->getLevel()->addParticle(new Vector3(new HeartParticle($x$y$z)));
    and i got a error say "undefined vairable x y z"
  6. R7vmc
    Offline

    R7vmc New Member

    Joined:
    Aug 2, 2016
    Posts:
    22
    Minecraft User:
    R7vmc
    im really sucks at coding xD

    i will be better soon :)
  7. R7vmc
    Offline

    R7vmc New Member

    Joined:
    Aug 2, 2016
    Posts:
    22
    Minecraft User:
    R7vmc
    okkkk i fixed it all! i just changed the Vector3 and HeartParticle Places And added player->$x $y $z and my Plugin Worked!
    PHP:
    $player->getLevel()->addParticle(new HeartParticle3(new Vector3($player->x$player->y$player->z)));
  8. R7vmc
    Offline

    R7vmc New Member

    Joined:
    Aug 2, 2016
    Posts:
    22
    Minecraft User:
    R7vmc
    thanks @luca28pet and Tim For helping fix my code <3
  9. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Just so you know what the error means:
    Undefined variable means, of course, that the variable isn't defined. Means, you didn't give $x, $y, $z any values. You have to set them before you use them. For example:
    PHP:
    $x $player->getX();
    $y $player->getY();
    $z $player->getZ();
  10. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    You could always do :)
    PHP:
    $player->getLevel()->addParticle(new HeartParticle($player));
    Last edited: Aug 2, 2016
    R7vmc and SOFe like this.
  11. R7vmc
    Offline

    R7vmc New Member

    Joined:
    Aug 2, 2016
    Posts:
    22
    Minecraft User:
    R7vmc
    thanks this is simpler :)

Share This Page

Advertisement