Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Buggy packet movement

Comments in 'Plugin Development' started by Flabe, Mar 3, 2016.

  1. Flabe
    Offline

    Flabe Active Member

    Joined:
    Nov 17, 2015
    Posts:
    147
    Minecraft User:
    Flabe231
    Hi , i tried to make disguise in pig code , but i have a problem : i have a buggy movement (when player moves it looks like he is jumping all the time , is it possible to fix it?).
    PHP:
    public function onPacketSend(DataPacketSendEvent $event){
     if(
    $event->getPacket() instanceof AddPlayerPacket && $event->getPacket()->username === "Flabe231"){
     if(
    $event->getPacket() instanceof AddPlayerPacket){$pk = new AddEntityPacket;$pk->eid $event->getPacket()->eid;$pk->type 12;$pk->$event->getPacket()->x;$pk->$event->getPacket()->y;$pk->$event->getPacket()->z;$pk->pitch $event->getPacket()->pitch;$pk->yaw $event->getPacket()->yaw;$pk->metadata = [];$event->getPlayer()->dataPacket($pk);$event->setCancelled();
     }
     if(
    $event->getPacket() instanceof MovePlayerPacket){$pk = new MoveEntityPacket;$pk->entities = [[$event->getPacket()->eid$event->getPacket()->x$event->getPacket()->y$event->getPacket()->z$event->getPacket()->yaw$event->getPacket()->pitch]];$event->getPlayer()->dataPacket($pk);$event->setCancelled();
     }
     if(
    $event->getPacket() instanceof RemovePlayerPacket){$pk = new RemoveEntityPacket;$pk->eid $event->getPacket()->eid;$event->getPlayer()->dataPacket($pk);$event->setCancelled();
     }
     }
     }
    -------------------------------------------------------------------------------------------------------------------------------
    Please help if you know, i will be very happy^_^
  2. Flabe
    Offline

    Flabe Active Member

    Joined:
    Nov 17, 2015
    Posts:
    147
    Minecraft User:
    Flabe231
    i tried all but it didn't worked(((
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Indent your code better?
    applqpak likes this.
  4. Flabe
    Offline

    Flabe Active Member

    Joined:
    Nov 17, 2015
    Posts:
    147
    Minecraft User:
    Flabe231
    sorry i don't understand what do you mean...
  5. Flabe
    Offline

    Flabe Active Member

    Joined:
    Nov 17, 2015
    Posts:
    147
    Minecraft User:
    Flabe231
    do you know what's the problem??
  6. Flabe
    Offline

    Flabe Active Member

    Joined:
    Nov 17, 2015
    Posts:
    147
    Minecraft User:
    Flabe231
    nobody knows?(((
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Do you expect anyone to be able to read your code if you format them like this?
    applqpak and jojoe77777 like this.
  8. Flabe
    Offline

    Flabe Active Member

    Joined:
    Nov 17, 2015
    Posts:
    147
    Minecraft User:
    Flabe231
    i didn't formatted it in raw, i just copied it from my file:/
  9. Flabe
    Offline

    Flabe Active Member

    Joined:
    Nov 17, 2015
    Posts:
    147
    Minecraft User:
    Flabe231
    PHP:
    public function onPacketSend(DataPacketSendEvent $event){
                if(
    $event->getPacket() instanceof AddPlayerPacket){
                    if(
    $event->getPlayer() === "Sasha_836"){
                      if(
    $event->getPacket() instanceof AddPlayerPacket){
                              
    $pk = new AddEntityPacket;
                              
    $pk->eid $event->getPacket()->eid;
                              
    $pk->type 34;
                              
    $pk->$event->getPacket()->x;
                              
    $pk->$event->getPacket()->$event->getPacket()->height 2;
                              
    $pk->$event->getPacket()->z;
                              
    $pk->pitch $event->getPacket()->pitch;
                              
    $pk->yaw $event->getPacket()->yaw;
                              
    $pk->metadata = [];
                              
    $event->getPlayer()->dataPacket($pk);
                              
    $event->setCancelled();
                      }
                      if(
    $event->getPacket() instanceof MovePlayerPacket){
                              
    $pk = new MoveEntityPacket;
                              
    $pk->entities = [[$event->getPacket()->eid$event->getPacket()->x$event->getPacket()->y$event->getPacket()->z$event->getPacket()->yaw$event->getPacket()->pitch]];
                              
    $event->getPlayer()->dataPacket($pk);
                              
    $event->setCancelled();
                      }
                      if(
    $event->getPacket() instanceof RemovePlayerPacket){
                              
    $pk = new RemoveEntityPacket;
                              
    $pk->eid $event->getPacket()->eid;
                              
    $event->getPlayer()->dataPacket($pk);
                              
    $event->setCancelled();
                      }
                }
            }
        }



  10. Flabe
    Offline

    Flabe Active Member

    Joined:
    Nov 17, 2015
    Posts:
    147
    Minecraft User:
    Flabe231
    here is it)))
  11. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    653
    Plugins:
    1
    Minecraft User:
    jojoe77777
    PHP:
    if($event->getPlayer() === "Sasha_836"){
    A player is not a string. I think you mean this:
    PHP:
    if($event->getPlayer()->getName() === "Sasha_836"){
  12. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Why are all the packet conditionals under the AddPlayerPacket condition?

Share This Page

Advertisement