diff --git a/src/network/protocol/packet/PlayerInputPacket.php b/src/network/protocol/packet/PlayerInputPacket.php index 4fd61dbf..af3a5e94 100644 --- a/src/network/protocol/packet/PlayerInputPacket.php +++ b/src/network/protocol/packet/PlayerInputPacket.php @@ -1,6 +1,6 @@ unk1 = $this->getFloat(); $this->unk2 = $this->getFloat(); - $this->unk3 = $this->getByte(); - $this->unk4 = $this->getByte(); + $this->sneaking = bin2hex($this->buffer)[$this->getOffset()] === 4; + $this->unk4 = bin2hex($this->buffer)[$this->getOffset()+1] === 4; } } diff --git a/src/network/raknet/RakNetDataPacket.php b/src/network/raknet/RakNetDataPacket.php index 255d6b54..48acd734 100755 --- a/src/network/raknet/RakNetDataPacket.php +++ b/src/network/raknet/RakNetDataPacket.php @@ -20,7 +20,11 @@ abstract class RakNetDataPacket extends stdClass{ public function getBuffer(){ return $this->buffer; } - + + public function getOffset(){ + return $this->offset; + } + public function setBuffer($buffer = ""){ $this->buffer = $buffer; $this->offset = 0; diff --git a/src/utils/Utils.php b/src/utils/Utils.php index b9f3a859..49ff6bc5 100644 --- a/src/utils/Utils.php +++ b/src/utils/Utils.php @@ -638,6 +638,7 @@ class Utils{ } public static function readInt($str){ + if(strlen($str) <= 0) return; if(PHP_INT_SIZE === 8){ return @unpack("N", $str)[1] << 32 >> 32; }else{