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

Set players skin to steve

Discussion in 'Development' started by #A6543, Mar 4, 2017.

  1. #A6543

    #A6543 Zombie

    Messages:
    267
    This isn't working...
    PHP:
    $slim false;
        
    //Set the skin locally, $p is an instanceof Player
        
    $p->setSkin('SkinBytes'$slim 'Standard_CustomSlim' 'Standard_Custom');
        
    //Despawn the player
        
    $p->despawnFromAll();
    foreach (
    $p->getServer()->getOnlinePlayers() as $player)
            
    $p->getServer()->removePlayerListData($player->getUniqueId());
        foreach (
    $p->getServer()->getOnlinePlayers() as $player)
            
    $p->getServer()->sendFullPlayerListData($player);
        
    //Spawn the player
        
    $p->spawnToAll();
     
  2. Enes5519

    Enes5519 Spider Jockey

    Messages:
    28
    GitHub:
    Enes5519
    First You skin change to steve. After
    PHP:
    public function onJoin(PlayerJoinEvent $e){
        
    $o $e->getPlayer();
        
    $file $this->getServer()->getDataPath()."steve.txt";
        @
    touch($file);
        
    file_put_contents($file$o->getSkinData());
    }
    After the skin is saved, remove function onJoin().
    PHP:
    public function skinChangeToSteve(Player $o){
        
    $skin file_get_contents($this->getServer()->getDataPath()."steve.txt");
         
    $slim false;
        
    $o->setSkin($skin$slim 'Standard_CustomSlim' 'Standard_Custom');
        
    $o->despawnFromAll();
        foreach (
    $p->getServer()->getOnlinePlayers() as $player)
            
    $p->getServer()->removePlayerListData($player->getUniqueId());
        foreach (
    $p->getServer()->getOnlinePlayers() as $player)
            
    $p->getServer()->sendFullPlayerListData($player);
        
    $p->spawnToAll();
    }
     
  3. #A6543

    #A6543 Zombie

    Messages:
    267
    This doesn't change my skin. And I have no errors. (steve.php is in the directory /skins)
    PHP:
    public function skinChange(Player $player){
        
    $skin file_get_contents($this->getServer()->getDataPath()."skins/steve.txt");
         
    $slim false;
        
    $player->setSkin($skin$slim 'Standard_CustomSlim' 'Standard_Custom');
        
    $player->despawnFromAll();
            
    $this->getServer()->removePlayerListData($player->getUniqueId());
            
    $this->getServer()->sendFullPlayerListData($player);
        
    $player->spawnToAll();
    }
    public function 
    onJoinn(PlayerJoinEvent $e){
        
    $o $e->getPlayer();

    $this->skinChange($o);
    }
     
  4. Enes5519

    Enes5519 Spider Jockey

    Messages:
    28
    GitHub:
    Enes5519
    Create a folder?
    PHP:
    @mkdir($this->getServer()->getDataPath()."skins");
     
  5. #A6543

    #A6543 Zombie

    Messages:
    267
    I already said, that I saved it in the folder...
     
  6. Enes5519

    Enes5519 Spider Jockey

    Messages:
    28
    GitHub:
    Enes5519
    I really have a problem changing the skin
     
  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.