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

Solved If player entered a area code

Comments in 'Plugin Development' started by korado531m7, Jan 1, 2016.

  1. korado531m7
    Offline

    korado531m7 Active Member

    Joined:
    Apr 4, 2015
    Posts:
    158
    Minecraft User:
    korado531m7
    Hi.
    Please tell me the code.
  2. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    PHP:
    if($player->getX() == $x && $player->getY() == $y && $player->getZ() == $z){
    //Code
    }
    Last edited: Jan 1, 2016
  3. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    $player->getX() == $z ?
    Last edited: Jan 1, 2016
    PocketKiller likes this.
  4. PixelGuy75
    Offline

    PixelGuy75 Notable Member Plugin Developer

    Joined:
    Feb 9, 2014
    Posts:
    316
    Plugins:
    2
    Minecraft User:
    PixelGuy75
    It makes sense if you don't think about it.
    LDX likes this.
  5. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    I made a mistake, I Edited the post
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Do you think that corrects everything? The question is asking about an area. How does $x refer to an area? You are only referring to a certain coordinate.

    @korado531m7 compare the player coordinates with <=:
    PHP:
    $x $player->getX();
    $z $player->getZ();
    $isInArea = ($minX <= $x and $x <= $maxX and $minZ <= $z and $z <= $maxZ);
    thebigsmileXD and Vaivez66 like this.
  7. korado531m7
    Offline

    korado531m7 Active Member

    Joined:
    Apr 4, 2015
    Posts:
    158
    Minecraft User:
    korado531m7
    Thanks a lot. I'm busy now. So I'll use this later.
  8. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    To get minX or maxX use: min() and max().
    And the @PEMapModder's code reffers to unlimited Y axis. So don't post it as bug
  9. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    What is an area?
  10. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Don't try to understand everything as it's written, we are humans thats why there is ereaser on top of pencil.
    AndrewBit likes this.
  11. PixelGuy75
    Offline

    PixelGuy75 Notable Member Plugin Developer

    Joined:
    Feb 9, 2014
    Posts:
    316
    Plugins:
    2
    Minecraft User:
    PixelGuy75
    Eraser* sorry, I couldn't resist. :)
  12. korado531m7
    Offline

    korado531m7 Active Member

    Joined:
    Apr 4, 2015
    Posts:
    158
    Minecraft User:
    korado531m7
    Thank you for answering everyone. I solved this question.
    HotFireyDeath likes this.

Share This Page

Advertisement