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

Solved Error in Teleport with PlayerInteractEvent

Discussion in 'Development' started by Palente, Nov 27, 2017.

  1. Palente

    Palente Slime

    Messages:
    75
    GitHub:
    palente
    Hey,
    I Have that error when i teleport a player to a location i don't see why
    PHP:
    public function onInt(PlayerInteractEvent $event){
    $player $event->getPlayer();
    $block $event->getBlock();
    $tile $player->getLevel()->getTile($block);
    if(
    $tile instanceof Sign){
    $text $tile->getText();
    if(
    $text[0] == "§4[FFA]" || $text[0] == "[FFA]"){
        
    $player->sendMessage("Chargement FFA....");
        
    $this->JoinFFA($player);
        }
    }
    }
    PHP:
    public function JoinFFA(Player $player){
        
    $level $this->getServer()->getLevelByName("ffa");
        
    $player->teleport(new Location(26777248$level));
    //Some more Code but not using teleport
    }
    Code:
    Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'FFA v0.0.1Pendoria': Argument 2 passed to pocketmine\entity\Entity::setPositionAndRotation() must be of the type float, object given, called in phar:///jar/PMMP-V1.7.phar/src/pocketmine/entity/Entity.php on line 1795 on Palente\FFA\Main
     
  2. DanielYTK

    DanielYTK Zombie

    Messages:
    227
    use pocketmine\level\Position; because in pocketmine\level\Location you must especify a Yaw and Pitch
     
    jasonwynn10 and Palente like this.
  3. Palente

    Palente Slime

    Messages:
    75
    GitHub:
    palente
    Thanks, Im confused i have mix function
     
    DanielYTK likes this.
  4. TGames

    TGames Silverfish

    Messages:
    18
  5. Palente

    Palente Slime

    Messages:
    75
    GitHub:
    palente
    ??Please dont reply if you have anithing to say and this thread is Solved so...
     
  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.