Advertisement
Zekrommaster110

[LUA | CC1.4.7] Elevator Client

Oct 22nd, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. --os.sleep(5) --if your server is making trouble after restart with this program please activate this delay to solve
  2.  
  3. -- VARIABLES
  4.  
  5. sides = {"top", "bottom", "front", "back", "left", "right"}
  6. i = 6
  7. while i >= 1 do
  8.     if peripheral.isPresent(sides[i]) == true then
  9.         rednet.open(sides[i])
  10.     end
  11.     i = i - 1
  12. end
  13.  
  14. -- Automatic detection of server id from server
  15. -- serverID = <enter serverID here> --use this and disable the code below to disable automatic id detection system
  16. shell.run("clear")
  17. print("[ELEVATOR] Wating for server broadcast to grab server id...")
  18. PREserverID, message, dist = rednet.receive()
  19. if message == "547892135" then
  20.     serverID = PREserverID
  21. end
  22.  
  23. while true do
  24.  
  25.     shell.run("clear")
  26.     print("[ELEVATOR] Please chose your etage you want to elevate to (between 1 and 15): ")
  27.     etage = io.read()
  28.    
  29.     if tonumber(etage) >= 1 and tonumber(etage) <= 15 then
  30.         rednet.send(serverID, etage)
  31.         shell.run("clear")
  32.     else
  33.         print("Your input is invalid. Please type in a number between 1 and 15.")
  34.         io.read()
  35.         shell.run("clear")
  36.     end
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement