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

chair plugin

Discussion in 'Development' started by hexmor, Jul 9, 2018.

  1. hexmor

    hexmor Baby Zombie

    Messages:
    110
    GitHub:
    h3xmor
    hi guys
    i have a chiar plugin but when i try to sit i see this error
    Code:
    15:15:32 CRITICAL > Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'MmsCore v1.0.1': Argument 1 passed to pocketmine\network\mcpe\NetworkBinaryStream::putEntityUniqueId() must be of the type integer, null given, called in C:\Users\Administrator\Desktop\Mine_Pelx\src\pocketmine\network\mcpe\NetworkBinaryStream.php on line 486 on MmsCore\MainIR
    15:15:32 CRITICAL > TypeError: "Argument 1 passed to pocketmine\network\mcpe\NetworkBinaryStream::putEntityUniqueId() must be of the type integer, null given, called in C:\Users\Administrator\Desktop\Mine_Pelx\src\pocketmine\network\mcpe\NetworkBinaryStream.php on line 486" (EXCEPTION) in "src/pocketmine/network/mcpe/NetworkBinaryStream" at line 287
    
    how can i fix ?? help me plz i need it
    if U have a chair plugin give me plz​
     
  2. hexmor

    hexmor Baby Zombie

    Messages:
    110
    GitHub:
    h3xmor
    helpppppppppppppppppppppppppppppppp
     
  3. HBIDamian

    HBIDamian HBIDamian Staff Member

    Messages:
    365
    GitHub:
    HBIDamian
    No one can fix it without seeing the code.
     
  4. kiencool

    kiencool Spider Jockey

    Messages:
    36
  5. HBIDamian

    HBIDamian HBIDamian Staff Member

    Messages:
    365
    GitHub:
    HBIDamian
    From what I can see, this plugin is catered for the latest DEVELOPMENT release of PocketMine. (4.0.0)
    This is not recommended.

    It is also not recommended to use plugins that are not off poggit, as there could be a chance that there is malicious code, or broken code.

    Stay with Update 3.0.x for now.
     
  6. hexmor

    hexmor Baby Zombie

    Messages:
    110
    GitHub:
    h3xmor
    this is code
    Code:
    <?php
    
    declare(strict_types=1);
    namespace MmsCore;
    
    use pocketmine\Server;
    use pocketmine\Player;
    use pocketmine\entity\Entity;
    use pocketmine\entity\Zombie as FakeRidingEntity;
    use pocketmine\level\Level;
    use pocketmine\level\Position;
    use pocketmine\network\mcpe\protocol\AddEntityPacket;
    use pocketmine\network\mcpe\protocol\SetEntityLinkPacket;
    use pocketmine\network\mcpe\protocol\RemoveEntityPacket;
    use pocketmine\network\mcpe\protocol\types\EntityLink;
    use pocketmine\math\Vector3;
    
    class Chair extends Position{
    
        private $id;
        private $entity;
    
        public function __construct(Entity $entity, $x, $y, $z, Level $level){
            parent::__construct($x, $y, $z, $level);
            $this->entity = $entity;
            $this->id = Entity::$entityCount++;
        }
        public function getId(){
            return $this->id;
        }
        public function getEntity(){
            return $this->entity;
        }
        public function spawnTo(Player $player){
            $pk = new AddEntityPacket();
            $pk->entityRuntimeId = $this->id;
            $pk->motion = new Vector3(0, 0, 0);
            $pk->position = $this->asVector3()->add(0.5, 1.8, 0.5);
            $pk->type = FakeRidingEntity::NETWORK_ID;
            $flags = 1 << Entity::DATA_FLAG_INVISIBLE;
            $flags ^= 1 << Entity::DATA_FLAG_NO_AI;
            $flags ^= 1 << Entity::DATA_FLAG_CAN_SHOW_NAMETAG;
            $flags ^= 1 << Entity::DATA_FLAG_ALWAYS_SHOW_NAMETAG;
            $pk->metadata = [
                Entity::DATA_FLAGS => [Entity::DATA_TYPE_LONG, $flags]
            ];
            $player->dataPacket($pk);
            $pk = new SetEntityLinkPacket();
            $pk->link = new EntityLink();
            $pk->link->fromEntityUniqueId = $this->id;
            $pk->link->toEntityUniqueId = $this->entity->getId();
            $pk->link->type = 0b01;
            $pk->link->bool1 = true;
            $player->dataPacket($pk);
            $player->sendTip(" \n ");
            $player->sendPopup("§aNeshasti");
            //$this->entity->setGenericFlag(Entity::DATA_FLAG_NO_AI, true);
        }
        public function spawnToAll(){
            foreach($this->level->getPlayers() as $player){
                $this->spawnTo($player);
            }
        }
        public function despawnFrom(Player $player){
            if($player === $this->entity){
                //$this->entity->setGenericFlag(Entity::DATA_FLAG_NO_AI, false);
            }
            $pk = new RemoveEntityPacket();
            $pk->entityUniqueId = $this->id;
            $player->dataPacket($pk);
        }
        public function despawnFromAll(){
            foreach($this->level->getPlayers() as $player){
                $this->despawnFrom($player);
            }
        }
    }
    
     
  7. hexmor

    hexmor Baby Zombie

    Messages:
    110
    GitHub:
    h3xmor
  8. HBIDamian

    HBIDamian HBIDamian Staff Member

    Messages:
    365
    GitHub:
    HBIDamian
    From what I can see, this plugin is catered for the latest DEVELOPMENT release of PocketMine. (4.0.0)
    This is not recommended.

    It is also not recommended to use plugins that are not off poggit, as there could be a chance that there is malicious code, or broken code.

    Stay with Update 3.0.x for now.
     
  9. hexmor

    hexmor Baby Zombie

    Messages:
    110
    GitHub:
    h3xmor
    ok have U a Sit plugin for api 3.0.X ???
     
  10. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    this is not a plugin help forum this is development forum which is for people to talk on how to make plugins
     
    EdwardHamHam likes this.
  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.