Nearest player with meters

Discussion in 'Plugin Help' started by PixelzChris, Jun 17, 2020.

  1. PixelzChris

    PixelzChris Silverfish

    Messages:
    18
    I need to get a Popup message everytime player holds an item but i dont know how to get Nearest player and meters can you help?

    Hotbar message: $pname / $distance (so i can use those strings in other things too)
     
  2. JviguyGamesYT

    JviguyGamesYT Slime

    Messages:
    86
    GitHub:
    jviguy
    hey so do need us to make a code that displays a actionbar to players. or a plugin that does it all.
     
  3. Heisenburger69

    Heisenburger69 Silverfish

    Messages:
    16
    GitHub:
    heisenburger69
    $player1->distance($player2);
    where both $player1 and $player2 are `Player` objects.
    You can handle the conversion yourself
     
  4. Primus

    Primus Zombie

    Messages:
    351
    According to minecraft wiki the 1 block = 1 meter
     
    Heisenburger69 likes this.
  5. JviguyGamesYT

    JviguyGamesYT Slime

    Messages:
    86
    GitHub:
    jviguy
    Would This Work I found it on the old forms posted by Falk its the http://en.wikipedia.org/wiki/Euclidean_distance formatted into php
    PHP:
    public function findDist(Position $aPosition $b)
            {
                return 
    sqrt(pow($a->$b->x2) + pow($a->$b->y2) + pow($a->$b->z2));
     
  6. JviguyGamesYT

    JviguyGamesYT Slime

    Messages:
    86
    GitHub:
    jviguy
  7. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,978
    GitHub:
    sof3
    In fact meters are just a convention based on the fact that doors should be 2 meters tall.
     

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.