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

add cape to players

Discussion in 'Development' started by Levi, Jun 10, 2018.

  1. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    how do you add cape to players? Server will do it
     
  2. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    Theres a server that does this its called Sylph factions
     
  3. AshBull

    AshBull Spider Jockey

    Messages:
    31
    https://github.com/pmmp/PocketMine-...a8822c8873/src/pocketmine/entity/Skin.php#L33

    PHP:
    $oldSkin $player->getSkin();
    $capeData "...";
    $skin = new Skin($oldSkin->getSkinId(), $oldSkin->getSkinData(), $capeData$oldSkin->getGeometryName(), $oldSkin->getGeometryData());
    $player->setSkin($skin);
    $player->sendSkin();
    Basic example of how to set the cape. $capeData should be a 8192 char long ARGB blob, which you can get from a PNG using GD
     
  4. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    Is link ok?
     
  5. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    For capes
     
  6. YasinK

    YasinK Creeper

    Messages:
    4
    GitHub:
    yasink
    what is GD ?
     
  7. r7vmc

    r7vmc Baby Zombie

    Messages:
    112
    GitHub:
    r7vmc
    it's a library to work with images in PHP GD
     
  8. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    how do i use
     
  9. r7vmc

    r7vmc Baby Zombie

    Messages:
    112
    GitHub:
    r7vmc
    PHP:
    $oldSkin $player->getSkin();
    $capeData = @imagecreatefrompng(/path/to/cape.png);
    $skin = new Skin($oldSkin->getSkinId(), $oldSkin->getSkinData(), $capeData$oldSkin->getGeometryName(), $oldSkin->getGeometryData());
    $player->setSkin($skin);
    $player->sendSkin();
     
    Lolipop78709 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.