setSkin

Discussion in 'Development' started by Muhammed0232, Aug 18, 2018.

  1. Muhammed0232

    Muhammed0232 Silverfish

    Messages:
    15
    GitHub:
    Muhammed0232
    How to Change the Player Skin to Spiderman.jpg
     
  2. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    686
    GitHub:
    xXNiceYT
  3. Muhammed0232

    Muhammed0232 Silverfish

    Messages:
    15
    GitHub:
    Muhammed0232
  4. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    686
    GitHub:
    xXNiceYT
    Make jpg to png
     
  5. Muhammed0232

    Muhammed0232 Silverfish

    Messages:
    15
    GitHub:
    Muhammed0232
    İ Make To Png Don't Worked
     
  6. Muhammed0232

    Muhammed0232 Silverfish

    Messages:
    15
    GitHub:
    Muhammed0232
    Code:

    public function SetSkin($player, string $file, string $ex){
    $skin = $player->getSkin();
    $path = $this->p->getDataFolder() . $file . $ex;
    $img = @imagecreatefrompng($path);
    $skinbytes = "";
    $s = (int)@getimagesize($path)[1];

    for($y = 0; $y < $s; $y++){
    for($x = 0; $x < 64; $x++){
    $colorat = @imagecolorat($img, $x, $y);
    $a = ((~((int)($colorat >> 24))) << 1) & 0xff;
    $r = ($colorat >> 16) & 0xff;
    $g = ($colorat >> 8) & 0xff;
    $b = $colorat & 0xff;
    $skinbytes .= chr($r) . chr($g) . chr($b) . chr($a);
    }
    }
    @imagedestroy($img);

    $player->setSkin(new Skin($skin->getSkinId(), $skinbytes));
    $player->sendSkin();
    }
     
  7. Muhammed0232

    Muhammed0232 Silverfish

    Messages:
    15
    GitHub:
    Muhammed0232
    Eror:
     

    Attached Files:

  8. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    686
    GitHub:
    xXNiceYT
    You have to enable image

    go to php.ini
    Replace
    PHP:
    ;extension=php_gd2.dll
    To
    PHP:
    extension=php_gd2.dll
     
  9. Mmdkvz

    Mmdkvz Creeper

    Messages:
    1
    GitHub:
    JanahMp
    Hello
    Im download the pocketmine-mp app and replace this to php.ini but its not working
     

    Attached Files:

  10. HimbeersaftLP

    HimbeersaftLP Wither Skeleton

    Messages:
    1,471
    GitHub:
    HimbeersaftLP
    I assume you php binary wasn't compiled with gd support, you will need to recompile it.
     
    xXNiceAssassinlo YT likes this.

Share This Page

  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.