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

Teleportation

Comments in 'Plugin Development' started by mrfoxvolt, May 28, 2014.

  1. mrfoxvolt
    Offline

    mrfoxvolt Active Member Plugin Developer

    Joined:
    Jan 26, 2014
    Posts:
    52
    Plugins:
    1
    Minecraft User:
    rirititi
    hello,

    i'm creating a plugin (mini game) and i want know how to teleport all player in the word with coordonné random
  2. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    Don't know what you mean by coordonne random, but this:
    PHP:
    foreach($this->api->player->getAll($this->api->level->get("world")) as $p$p->teleport(new Position($x,$y,$z,$level));
    PEMapModder likes this.
  3. MegaSamNinja
    Offline

    MegaSamNinja Active Member

    Joined:
    Sep 13, 2013
    Posts:
    138
    Minecraft User:
    Bamuel
    Or /tp @all xcoords ycoords zcoords
  4. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    Thats all the players, not from a specific world ;)
    PEMapModder likes this.
  5. mrfoxvolt
    Offline

    mrfoxvolt Active Member Plugin Developer

    Joined:
    Jan 26, 2014
    Posts:
    52
    Plugins:
    1
    Minecraft User:
    rirititi
    if we are 4 players. when my game start i went the 4 players are teleporting in different coordinate (X,Y,Z)
  6. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    Randomly?
  7. mrfoxvolt
    Offline

    mrfoxvolt Active Member Plugin Developer

    Joined:
    Jan 26, 2014
    Posts:
    52
    Plugins:
    1
    Minecraft User:
    rirititi
  8. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    PHP:
    $players = array();//put the player objects in here
    $coords = array("0"=>array("x"=>x,"y"=>y,"z"=>z,"level"=>level),"1"=>array("x"=>x,"y"=>y,"z"=>z,"level"=>level));//keep adding
    foreach($players as $p){
       
    $r rand(0,count($coords));
       
    $p->teleport(new Position($coords[$r]["x"],$coords[$r]["y"],$coords[$r]["z"],$this->api->level->get($coords[$r]["x"])));
    }
    something like this?
  9. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    PHP:
    rand(/*inclusive lower limit*/255 /*inclusive upper limit*/)

Share This Page

Advertisement