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

Player Movement

Comments in 'Plugin Development' started by imJayL, Feb 28, 2016.

  1. imJayL
    Offline

    imJayL Active Member

    Joined:
    Aug 5, 2015
    Posts:
    52
    Minecraft User:
    PHC_imJayL
    Player wont move until the game starts .

    What is the code for this?
    Thanks in advance
  2. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    If the Game isn't started, cancel PlayerMoveEvent.
    PEMapModder likes this.
  3. imJayL
    Offline

    imJayL Active Member

    Joined:
    Aug 5, 2015
    Posts:
    52
    Minecraft User:
    PHC_imJayL
    Example of the codes?
  4. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    It can be done with a simple if statment.
    PHP:
     if(gameIsStarted) {
      
    // cancel event
    }
  5. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    PHP:

    public $games "N";

    // Code

    if($this->games == "S"){

    //  cancel Move

    }
    // How Can Start IT !

    $this->games "S";
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    And mind explaining what these strings are?
    Also, might be more efficient using booleans or integers.
  7. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    i canot speak EN Very Nice
    To Explain I Have 4 Months to learn EN
  8. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    You probably are talking to yourself. How should I create the code without knowing anything about your code?
    PEMapModder likes this.
  9. xBeastMode
    Offline

    xBeastMode Active Member

    Joined:
    Nov 27, 2015
    Posts:
    292
    Here's a example, but I don't know how your game works.
    PHP:
    //game started variable, not yet started
    private $started  false;

    //function to start game, player can move
    public function startGame(){
    $this->started true;
    }

    public function 
    onMove(){
    $p $e->getPlayer();
    //check if game didn't start
    if(!$this->started){

    //option 1
    //player can move head
    $from = clone $e->getFrom();
    $to $e->getTo();
    $from->yaw $to->yaw;
    $from->pitch $yaw->pitch;
    $e->setTo($from);

    //option 2
    //player cannot move head
    $e->setCancelled();
    }
    }

    Skullex likes this.
  10. imJayL
    Offline

    imJayL Active Member

    Joined:
    Aug 5, 2015
    Posts:
    52
    Minecraft User:
    PHC_imJayL

Share This Page

Advertisement