Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to get a exact XYZ ?

Comments in 'Plugin Development' started by PlayCubePE, Aug 1, 2015.

  1. PlayCubePE
    Offline

    PlayCubePE New Member

    Joined:
    Mar 19, 2015
    Posts:
    29
    Minecraft User:
    PlayCubePE
    Hello, i just need to know how to get a non decimal position !

    I used :

    getX
    getY
    getZ

    And i got some crazy numbers like 124,00754325865 and so on..

    But i just want to get 124

    Without Decimal
  2. iiDeathStrokeii
    Offline

    iiDeathStrokeii Active Member

    Joined:
    Mar 30, 2015
    Posts:
    111
    Minecraft User:
    iiDeathstrokeii
    Getround() I think.
  3. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    PHP:
    $x round($p->getX()); //If X is 124.0005 it'll return 124, if it's 124.58770000 it'll return 125
    //or:
    $x ceil($p->getX()); //If X is 124.0005 it'll return 125, if it's 124.58770000 it'll return 125
    //or:
    $x floor($p->getX()); //If X is 124.0005 it'll return 124, if it's 124.58770000 it'll return 124
    Last edited by a moderator: Aug 1, 2015
    TheKofola12 and PEMapModder like this.
  4. iiDeathStrokeii
    Offline

    iiDeathStrokeii Active Member

    Joined:
    Mar 30, 2015
    Posts:
    111
    Minecraft User:
    iiDeathstrokeii
    Orr use you math skills and see that it is 124
  5. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    I think he/she uses it in some if($x == 124) functions, so he/she can't solve it by seeing it ;)
    TheKofola12 likes this.
  6. PlayCubePE
    Offline

    PlayCubePE New Member

    Joined:
    Mar 19, 2015
    Posts:
    29
    Minecraft User:
    PlayCubePE
    Thanks you, solved
  7. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Read api!
    PHP:
    // All functions below will return integer
    $player->getFloorX();
    $player->getFloorY();
    $player->getFloorZ();
    Andrey Nazarchuk likes this.
  8. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    But floor($p->getX()); will work too!
    TheKofola12 and PEMapModder like this.

Share This Page

Advertisement