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

Set skin geometry

Discussion in 'Development' started by Joao Nunes, Jun 9, 2020.

  1. Joao Nunes

    Joao Nunes Spider Jockey

    Messages:
    30
    GitHub:
    joaonunes12
    Hello, I need help, when I try to put a skin geometry on the player is giving that error:

    "Invalid Skin data size 4096 bytes (Allowed sizes: 8192, 16384, 65536)"
    [​IMG]

    I'm using this code:

    PHP:
    public function setSkin($player) {
            
    $skin $player->getSkin();
           
    $path Main::getMainInstance()->getDataFolder() . 'Teste.png';
            
    $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"""geometry.rmsp.Teste"file_get_contents(Main::getMainInstance()->getDataFolder() . "geometry.Teste.json")));
            
    $player->sendSkin();
        }
     
  2. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    You have to add 2x more pixels
     
  3. Joao Nunes

    Joao Nunes Spider Jockey

    Messages:
    30
    GitHub:
    joaonunes12
    Who i can do it?
     
  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.