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

Construct InventoryTransactionPacket

Discussion in 'Development' started by SkyZone, Feb 14, 2018.

  1. SkyZone

    SkyZone Slime

    Messages:
    95
    PHP:
          $pk = new InventoryTransactionPacket();
                    
    $pk->transactionType InventoryTransactionPacket::TYPE_USE_ITEM_ON_ENTITY;
                    
    $pk->trData->actionType InventoryTransactionPacket::USE_ITEM_ON_ENTITY_ACTION_ATTACK;
                    
    $pk->trData->entityRuntimeId $id;
                    
    $pk->trData->hotbarSlot 0;
                    
    $pk->trData->itemInHand Item::get(Item::DIAMOND_SWORD);
                    
    $pk->trData->playerPos $this->lastpos;
                    
    $pk->trData->clickPos $position;
                    
    $pk->isCraftingPart false;
                    
    $pk->encode();
    My code isnt working, but idk why. Can anybody please help me?
     
  2. Sandertv

    Sandertv Zombie Pigman Poggit Reviewer

    Messages:
    786
    GitHub:
    Sandertv
    What do you expect this to do?
     
    xXNiceAssassinlo YT likes this.
  3. SkyZone

    SkyZone Slime

    Messages:
    95
    Attack an player nearby an player. I want to do this with an packet. The packet is sent by an proxy. I want to create a completly new Minigame.
     
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    What in it is not working? And are there any errors?
     
    EdwardHamHam likes this.
  5. SkyZone

    SkyZone Slime

    Messages:
    95
    Warning: Creating default object from empty value in C:\Users\SkyZoneMC\Desktop\Proxyyyyyyyy\plugins\SkyGame\src\Sky\Main.php on line 102
     
  6. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    PHP:
    $pk->trData = new \stdClass();
     
  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.