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(); }
You have to enable image go to php.ini Replace PHP: ;extension=php_gd2.dll To PHP: extension=php_gd2.dll