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

Teleporting between levels

Discussion in 'Development' started by XdmingXD, Jul 21, 2017.

  1. XdmingXD

    XdmingXD Baby Zombie

    Messages:
    158
    GitHub:
    xdmingxd
    Ok... so...
    I have written this in my plugin
    PHP:
    $pos = new Position($X $Y $Z $level);
    $player->teleport($pos);
    and it pop up this:
    Code:
    [20:01:23] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'MircoBattle v1.0.0': Argument 1 passed to pocketmine\network\mcpe\protocol\DataPacket::putVector3f() must be of the type float, string given, called in phar://C:/Users/Xdm/Desktop/XdNetWork/XdNetWork/PocketMine-MP.phar/src/pocketmine/network/mcpe/protocol/MovePlayerPacket.php on line 69 on MB\eventmanager
    [20:01:23] [Server thread/CRITICAL]: TypeError: "Argument 1 passed to pocketmine\network\mcpe\protocol\DataPacket::putVector3f() must be of the type float, string given, called in phar://C:/Users/Xdm/Desktop/XdNetWork/XdNetWork/PocketMine-MP.phar/src/pocketmine/network/mcpe/protocol/MovePlayerPacket.php on line 69" (EXCEPTION) in "src/pocketmine/network/mcpe/protocol/DataPacket" at line 374
    [20:01:23] [Server thread/WARNING]: XdmingXD moved too fast, reverting movement
    
    I have try debug level 2 :
    Code:
    [21:04:08] [Server thread/WARNING]: XdmingXD moved too fast, reverting movement
    [21:04:08] [Server thread/DEBUG]: Old position: Vector3(x=131,y=4,z=131), new position: Vector3(x=98.9654,y=-40,z=130.2488)
    [21:04:08] [Server thread/CRITICAL]: Could not tick level "MBStandard": Argument 1 passed to pocketmine\network\mcpe\protocol\DataPacket::putVector3f() must be of the type float, string given, called in phar://C:/Users/Xdm/Desktop/XdNetWork/XdNetWork/PocketMine-MP.phar/src/pocketmine/network/mcpe/protocol/MovePlayerPacket.php on line 69
    [21:04:08] [Server thread/CRITICAL]: TypeError: "Argument 1 passed to pocketmine\network\mcpe\protocol\DataPacket::putVector3f() must be of the type float, string given, called in phar://C:/Users/Xdm/Desktop/XdNetWork/XdNetWork/PocketMine-MP.phar/src/pocketmine/network/mcpe/protocol/MovePlayerPacket.php on line 69" (EXCEPTION) in "src/pocketmine/network/mcpe/protocol/DataPacket" at line 374
    [21:04:08] [Server thread/DEBUG]: #0 src/pocketmine/network/mcpe/protocol/MovePlayerPacket(69): pocketmine\network\mcpe\protocol\DataPacket->putVector3f(string 131, double 5.62, string 131)
    [21:04:08] [Server thread/DEBUG]: #1 src/pocketmine/network/mcpe/protocol/DataPacket(72): pocketmine\network\mcpe\protocol\MovePlayerPacket->encodePayload()
    [21:04:08] [Server thread/DEBUG]: #2 src/pocketmine/network/mcpe/RakLibInterface(200): pocketmine\network\mcpe\protocol\DataPacket->encode()
    [21:04:08] [Server thread/DEBUG]: #3 src/pocketmine/Player(1055): pocketmine\network\mcpe\RakLibInterface->putPacket(pocketmine\Player object, pocketmine\network\mcpe\protocol\MovePlayerPacket object, boolean , boolean )
    [21:04:08] [Server thread/DEBUG]: #4 src/pocketmine/Player(3734): pocketmine\Player->dataPacket(pocketmine\network\mcpe\protocol\MovePlayerPacket object)
    [21:04:08] [Server thread/DEBUG]: #5 src/pocketmine/Player(1588): pocketmine\Player->sendPosition(pocketmine\level\Location object, double 272, double 7, integer 1)
    [21:04:08] [Server thread/DEBUG]: #6 src/pocketmine/Player(1658): pocketmine\Player->processMovement(integer 1)
    [21:04:08] [Server thread/DEBUG]: #7 src/pocketmine/level/Level(722): pocketmine\Player->onUpdate(integer 11585)
    [21:04:08] [Server thread/DEBUG]: #8 src/pocketmine/Server(2301): pocketmine\level\Level->doTick(integer 11585)
    [21:04:08] [Server thread/DEBUG]: #9 src/pocketmine/Server(2456): pocketmine\Server->checkTickUpdates(integer 11585, double 1500642248.0965)
    [21:04:08] [Server thread/DEBUG]: #10 src/pocketmine/Server(2218): pocketmine\Server->tick()
    [21:04:08] [Server thread/DEBUG]: #11 src/pocketmine/Server(2097): pocketmine\Server->tickProcessor()
    [21:04:08] [Server thread/DEBUG]: #12 src/pocketmine/Server(1682): pocketmine\Server->start()
    [21:04:08] [Server thread/DEBUG]: #13 src/pocketmine/PocketMine(501): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string phar://C:/Users/Xdm/Desktop/XdNetWork/XdNetWork/PocketMine-MP.phar/, string C:\Users\Xdm\Desktop\XdNetWork\XdNetWork\, string C:\Users\Xdm\Desktop\XdNetWork\XdNetWork\plugins\)
    [21:04:08] [Server thread/DEBUG]: #14 C:/Users/Xdm/Desktop/XdNetWork/XdNetWork/PocketMine-MP.phar(1): require(string phar://C:/Users/Xdm/Desktop/XdNetWork/XdNetWork/PocketMine-MP.phar/src/pocketmine/PocketMine.php)
    
    I have no idea what happenned since the update of 3.0.0ALPHA5 or 3.0.0-ALPHA6
     
  2. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    Show your code before $pos = new Position($X , $Y , $Z , $level); how you set the $X, $Y, $Z and $level variables.

    And try turning on
    allow-movement-cheats in pocketmine.yml (on line 107).
     
  3. XdmingXD

    XdmingXD Baby Zombie

    Messages:
    158
    GitHub:
    xdmingxd
    Can you see here= =
     
  4. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    Show the code where you set the $X, $Y, $Z and $level variables.
     
  5. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    I have this too and it working only if I replace x y z variables with a number.
     
  6. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Quoting this line from your log:
    Code:
    [21:04:08] [Server thread/DEBUG]: #0 src/pocketmine/network/mcpe/protocol/MovePlayerPacket(69): pocketmine\network\mcpe\protocol\DataPacket->putVector3f(string 131, double 5.62, string 131)
    
    $X, $Y and $Z are strings and not floats (as required by Position). You need to convert them to flosts. Use floatval(). floatval() converts any value to float. You can also try float casting.
    PHP:
    //$X = "131"
    //$Y = "5.62"
    //$Z = "131"
    /** @var \pocketmine\level\Level|null $level */
    /** @var \pocketmine\Player $player */

    $X floatval($X);
    $Y floatval($Y);
    $Z floatval($Z);
    $pos = new Position($X$Y$Z$level);
    $player->teleport($pos);
     
    Levi, hoyinm14mc and XdmingXD like this.
  7. XdmingXD

    XdmingXD Baby Zombie

    Messages:
    158
    GitHub:
    xdmingxd
    I have somehow managed to fix it up
    I can now teleport to another world .(Thanks to @Awzaw )
    EDIT:
    and @Muqsit lol
     
    Last edited: Jul 23, 2017
  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.