Hi guys, I'm trying to send sounds to players by using PlaySoundPacket but it doesn't send anything and I don't know how to fix... This is my code: PHP: public static function playSound(Player $player, string $soundName, float $volume = 0, float $pitch = 0) { $pk = new PlaySoundPacket(); $pk->soundName = $soundName; $pk->x = (int)$player->x; $pk->y = (int)$player->y; $pk->z = (int)$player->z; $pk->volume = $volume; $pk->pitch = $pitch; $player->dataPacket($pk); } Spoiler: Code Example PHP: Utils::playSound($p, "game.player.hurt", 1, 0.8); Thank you for you help!
@dktapps sorry, I realized now that I accidentally created the thread in the facepalm section. Can you move it? Thank you! xD
Anyone know how to help me? EDIT: I tried to broadcast the packet, but nothing... PHP: if ($pk !== null) { if (!is_array($pk)) { Server::getInstance()->broadcastPacket($player->getLevel()->getPlayers(), $pk); } else { Server::getInstance()->batchPackets($player->getLevel()->getPlayers(), $pk); }}
tested on local MCPE vanilla server and MCPE and there it works well, with volume 1 and pitch 1, but if I send exactly same packet on pocketmine it doesn't work... probably pocketmine bug
I know that in vanilla works but in pocketmine not. Or for string "soundName" it means something else or I don't know...
I tested this packet with Minet client and MCPE sent exactly same packet like we do, so I really don't know what's wrong