code: PHP: $pk = new AdventureSettingsPacket();$pk->setFlag(AdventureSettingsPacket::WORLD_IMMUTABLE, true);$pk->setFlag(AdventureSettingsPacket::AUTO_JUMP, false);$player->dataPacket($pk); error: Code: "Argument 1 passed to pocketmine\utils\BinaryStream::putLLong() must be of the type int, null given, called in C:\Users\ziad0\OneDrive\Desktop\PocketMine\PocketMine-MP\src\pocketmine\network\mcpe\protocol\AdventureSettingsPacket.php on line 93" (EXCEPTION) in "vendor/pocketmine/binaryutils/src/BinaryStream" at line 307 Please help me
As we can see here, line 93 of the AdventureSettingsPacket encodes the entityUniqueId of the player. You didn't add that in your code, that's why it's null and thus crashes because putLLong doesn't accept null. We can see a reference implementation in the Player.php file: https://github.com/pmmp/PocketMine-...87565a7a91575/src/pocketmine/Player.php#L1418 Adapting this to your code would look like this: PHP: $pk = new AdventureSettingsPacket();$pk->setFlag(AdventureSettingsPacket::WORLD_IMMUTABLE, true);$pk->setFlag(AdventureSettingsPacket::AUTO_JUMP, false);$pk->entityUniqueId = $player->getId();$player->dataPacket($pk);
As @HimbeersaftLP pointed out, you need to set the player ID. Though I do not quite understand why (& how) you work with packets already while not understanding such a simple error message. Your error says a method called PHP: pocketmine\utils\BinaryStream::putLLong() wants an integer as the first argument, but received null. If you take a look at where it is called, you see this: PHP: $this->putLLong($this->entityUniqueId); With a little bit of logic understanding, you will now know that PHP: $this->entityUniqueId is null, or "not set", resulting in you having to set it.
Yeah actually i figured it out yesterday i didn't have time to set this thread as solved, but thank you guys anyway!