Advertisement
Guest User

Teleporter

a guest
May 4th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. os.loadAPI("button")
  2. m = peripheral.wrap("right")
  3. m.clear()
  4.  
  5. function fillTable()
  6.   button.setTable(" Spawn ", spawnToPos, 10, 20, 4, 6)
  7.   button.setTable(" Random ", randomSpawn, 10, 20, 10, 12)
  8.   button.screen()
  9. end
  10.  
  11. function spawnToPos()
  12.   commands.tell("@p", "Du wurdest zum Spawn teleportiert.\n Viel Spass bei deinem Abenteuer.")
  13.   commands.tp("@p", "-68", "71" , "239")
  14. end
  15.  
  16. function randomSpawn()
  17.   x = math.random(-500,500)
  18.   y = math.random(60,80)
  19.   z = math.random(-500,500)
  20.   commands.tell("@p", "Du wurdest an einen zufaelligen Ort teleportiert")
  21.   commands.tp("@p", x,y,z)
  22. end
  23.  
  24. function getClick()
  25.   event,side,x,y = os.pullEvent("monitor_touch")
  26.   button.checkxy(x,y)
  27. end
  28.  
  29. fillTable()
  30. button.heading("Choose a Spawnpoint")
  31.  
  32. while true do
  33.   getClick()
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement