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

Top question no send = =

Discussion in 'Development' started by sdsd16, Feb 28, 2019.

  1. sdsd16

    sdsd16 Spider Jockey

    Messages:
    41
    GitHub:
    Danding1314
    The Code

    public function TopPoint($p){
    $player = $p->getPlayer();
    $top = 0;
    $point = $this->p->getAll();
    arsort($point);
    $sd = "§e========§6[§aPoint§eTop§6]§e========";
    foreach($point as $k=>$v){
    $top++;
    if($top<=5){
    $x = $this->player->getLevel->getX("262.1587");
    $y = $this->player->getLevel->getY("69.963");
    $z = $this->player->getLevel->getZ("257.1069");

    $p = new FloatingTextParticle(new Vector3($x, $y + 1, $z), $sd, $k, $v);
    $player->getLevel()->addParticle($p);
    }
    }
    }


    Have any wrong ?
     
  2. Aericio

    Aericio Slime

    Messages:
    99
    GitHub:
    aericio
    If you have any errors to show, then also provide that or, if not, please state that there weren't any error messages so we can skip that step. Also, please show full code so we can have the full context (or at least all the necessary bits, if its a private plugin).

    Is that defined anywhere? If that is a player object, though, I don't see why you can't just use $player variable which you're already passing to the function...

    You can add a typehint to the function to make sure that $p is actually a player object by doing:
    PHP:
    use pocketmine\Player;

    public function 
    TopPoint(Player $p) {
        [...]
    }
     
    sdsd16 and jasonwynn10 like 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.