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

MurderMystery

Discussion in 'Development' started by Denzel Code, Jan 21, 2018.

  1. Denzel Code

    Denzel Code Spider

    Messages:
    10
    GitHub:
    denzelcode
    I'm creating a MurderMystery plugin from 0%, I'm 98% finished, but I need a command to get to a coordinate (it's an example), that tells you the steps you must do to get there.
    Can someone give me an example of how to do it?
     
  2. Denzel Code

    Denzel Code Spider

    Messages:
    10
    GitHub:
    denzelcode

    PHP:
    public function getPositionSteps(Player $playerPosition $position) : int {
                
    $playerPosition $player->getPosition();
              
                
    $playerX round($playerPosition->getX());
              
                
    $playerZ round($playerPosition->getZ());
              
                
    $positionX round($position->getX());
              
                
    $positionZ round($position->getZ());
              
                
    $steps $playerX $positionX;
              
                
    $steps abs($steps $playerZ $positionZ);
              
                return 
    $steps;
            }
     
  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.