Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Options:
- xMin: -9000 #Minimum x coordinate to teleport to
- xMax: 9000 #Maximum x coordinate to teleport to
- zMin: -9000 #Minimum z coordinate to teleport to
- zMax: 9000 #Maximum z coordinate to teleport to
- world: world #The name of the world
- loop: 20 #How many times to loop the script. 20 is usually WAY more than enough
- pause: 0.5 #How long to wait between each loop
- color: aqua #The color of the message sent to the player
- Command /randomtp:
- description: Teleports player to random location not in water
- usage: /randomtp
- permission: randomtp.use
- aliases: /rtp
- trigger:
- Loop {@loop} times:
- Set {_targetx} to a random integer between {@xMin} and {@xMax} #Location within world boundaries
- Set {_targetz} to a random integer between {@zMin} and {@zMax} #Location within world boundaries
- Execute console command "/getlocation %{_targetx}% 63 %{_targetz}% {@world}" #Convert location to useable format
- Set {_destination} to {ktools.location} #Convert global location to local variable
- Set {_light} to light level at {_destination} #Get light level at random location
- If the block 1 below the block at {_destination} is not water: #Make sure we don't teleport into water
- Send "<{@color}>Teleporting you to %{_targetx}%, %{_targetz}%" to player #Let the player know where they're going
- Execute console command "/tp %player% %{_targetx}% 256 %{_targetz}%" #Teleport player to highest y-coordinate. Will put them at highest block at x and z
- Stop loop
- If {_light} is less than 4: #If the water is under a block or underground
- Send "<{@color}>Teleporting you to %{_targetx}%, %{_targetz}%" to player #Let the player know where they're going
- Execute console command "/tp %player% %{_targetx}% 256 %{_targetz}%" #Teleport player to highest y-coordinate. Will put them at highest block at x and z
- Stop loop
- Wait {@pause} second
Advertisement
Add Comment
Please, Sign In to add comment