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

Head

Discussion in 'Development' started by LucGamesDE, May 19, 2017.

  1. LucGamesDE

    LucGamesDE Baby Zombie

    Messages:
    170
    How can I get the face of a player and print it into the chat?
     
  2. MalakasPlayzMC

    MalakasPlayzMC Spider Jockey

    Messages:
    37
    I think BrokenLens has this feature when you see your stats
     
  3. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
  4. LucGamesDE

    LucGamesDE Baby Zombie

    Messages:
    170
  5. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    can you show evidence of a previous attempt?
     
  6. Miste

    Miste Baby Zombie

    Messages:
    109
    GitHub:
    Misteboss
    Someone did it on github but with particles
     
  7. moska

    moska Baby Zombie

    Messages:
    105
    GitHub:
    supermaxalex
    Send link there
     
  8. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    here's an idea, i doubt anyone would even bother but here it is anyways
    you would need to condense the face part
    expecting face size X&Y to be equal
    chunk size = ideal display size / face size
    each chunk will be a square with chunk size as X&Y
    once you generated all chunks you could transform pixel into colour code, the majority one would be the represent for that said chunk
    this could work idk what's a better way to approach this
     
    jasonwynn10 likes this.
  9. Miste

    Miste Baby Zombie

    Messages:
    109
    GitHub:
    Misteboss
    Someone made that on Github, i tested it works, it sends the face of the head of the player in DustParticle (with colors)

    PHP:
    public function onPlayerInteract(\pocketmine\event\player\PlayerInteractEvent $event){
            
    $player $event->getPlayer();
            
    $level $player->getLevel();
            
    $skin substr($player->getSkinData(), ($pos = (64 4)) - 4$pos);
            for(
    $x 0$x 8$x++){
                for(
    $y 0$y 8$y++){
                    
    $key = ((64 $y) + $x) * 4;
                    
    $level->addParticle(new \pocketmine\level\particle\DustParticle($player->add($xx = ($x 4) * 0.3$yy - ($y 0.4), 0), $r ord($skin{$key}), $g ord($skin{$key+1}), $b ord($skin{$key+2}), $a ord($skin{$key+3})));
                    
    $level->addParticle(new \pocketmine\level\particle\DustParticle($player->add($xx$yy + ($y 0.15), 0), $r$g$b$a));
                    
    $level->addParticle(new \pocketmine\level\particle\DustParticle($player->add($xx + ($x 4) * 0.15$yy + ($y 0.2), 0), $r$g$b$a));
                    
    $level->addParticle(new \pocketmine\level\particle\DustParticle($player->add($xx + ($x 4) * 0.15$yy0), $r$g$b$a));
                }  
            }
        }
     
    [deleted] and jasonwynn10 like this.
  10. LucGamesDE

    LucGamesDE Baby Zombie

    Messages:
    170
    CRITICAL> ParseError: "syntax error, unexp
    ected 'public function onPlayerInte' (T_STRING), expecting functi
    on (T_FUNCTION)" (EXCEPTION)
     
  11. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    Show your whole code/file.
     
  12. Lowkey

    Lowkey Slime

    Messages:
    94
    Syntax errors!! USE AN ONLINE CHECKER, PLEASE
     
  13. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Yeah, blame XenForo. There probably aren't any errors in that code, you'll have to rewrite the whole thing rather than copy-paste it. Trust me, it's annoying but there's no other way. Been dealing with this problem (might be encoding) since the old forum.
     
    jasonwynn10, corytortoise and Lowkey like this.
  14. Lowkey

    Lowkey Slime

    Messages:
    94
    There is various online checkers I mean... he has obviously misplaced a character.
     
  15. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    I've not seen any php lint that fixes the error for you, and unless you are using a really nice IDE, I believe a syntax checker will only give you the same error PM does. Plus, as Muqsit said, it should be fixed by typing the code yourself. Why copy-paste, anyway? You don't learn nearly as much that way. I've seen several threads about the same issue. The code may look absolutely fine to us, but maybe not to PM.
     
    Muqsit, HimbeersaftLP and jasonwynn10 like this.
  16. LucGamesDE

    LucGamesDE Baby Zombie

    Messages:
    170
    And how can I post it in the chat?
     
  17. Miste

    Miste Baby Zombie

    Messages:
    109
    GitHub:
    Misteboss
    Legoboy0215 likes this.
  18. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    Muqsit likes this.
  19. Miste

    Miste Baby Zombie

    Messages:
    109
    GitHub:
    Misteboss
    jasonwynn10 likes this.
  20. Legoboy0215

    Legoboy0215 Witch

    Messages:
    64
    GitHub:
    legoboy0215
  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.