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

Random Spawn

Comments in 'Plugin Development' started by Sulfatezz, Feb 28, 2014.

  1. Sulfatezz
    Offline

    Sulfatezz Banned

    Joined:
    Dec 3, 2013
    Posts:
    9
    Minecraft User:
    Sulfatezz
    Hey coder!
    Now i need a code which allows players after dead to stay in this world and spawn then on certain spawns

    Thanks Sulfatezz
  2. Kripto
    Offline

    Kripto New Member

    Joined:
    Mar 2, 2014
    Posts:
    15
    Minecraft User:
    Kripto96
    You can use some like this, in the eventHandler:
    PHP:
    case "player.respawn":
    $data->teleport(new Vector3(rand(0128), 65rand(0128)));
    $data->sendChat("You've been teleported in a random place in the world.");
    break;
    If the spawn are just setted you can use:
    PHP:
    case "player.respawn":
    $spawnPoint rand(13); //if there are 3 spawn
    if($this->spawnPoint == 1) { //tp to first spawn
      
    $data->teleport(new Vector3(1236589)); //change with spawn coords
      
    $data->sendChat("You've been teleported to the first spawn point!");
    }
    elseif(
    $this->spawnPoint == 2) { //second
      
    $data->teleport(new Vector3(100695)); //change with spawn coords
      
    $data->sendChat("You've been teleported to the second spawn point!");
    }
    else 
    /*or elseif($this->spawnPoint == 3)*/ {
      
    $data->teleport(new Vector3(456)); //change with spawn coords
      
    $data->sendChat("You've been teleported to the third spawn point!");
    }
    It's not tested

Share This Page

Advertisement