Advertisement
Guest User

startup

a guest
Feb 23rd, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1. modem = peripheral.wrap("top")
  2. term.clear()
  3. term.setCursorPos(1, 1)
  4. users = {}
  5. channel1 = 4826
  6. channel2 = 3984
  7. function openPort(port)
  8.   if not modem.isOpen(port) then modem.open(port)
  9.   end
  10. end
  11.  
  12. args = {...}
  13.  
  14. if args[1] == "-mkuser" and #args < 3 then
  15. print("You are missing arguments.")
  16. return
  17. end
  18.  
  19. if args[1] == "-mkuser" and #args == 3 then
  20. users[#users+1] = args[2].." "..args[3]
  21. print("User successfully created!")
  22. return
  23. end
  24.  
  25. function reset()
  26. term.clear()
  27. term.setCursorPos(1, 1)
  28. end
  29.  
  30. print("Booting")
  31. sleep(0.5)
  32. reset()
  33. print("Booting.")
  34. sleep(0.5)
  35. reset()
  36. print("Booting..")
  37. sleep(0.5)
  38. reset()
  39. print("Booting...")
  40. sleep(1)
  41. reset()
  42.  
  43. openPort(channel1)
  44. openPort(channel2)
  45.  
  46.  
  47. function getInfo(usr, pswd)
  48. while usr == 0 or pswd == 0 do
  49.   event, side, frequency, replyFrequency,
  50.   message, distance =
  51.   os.pullEvent("modem_message")
  52.   if event == "modem_message" then
  53.     if frequency == channel1 then
  54.       username = message
  55.       sendChannel1 = replyFrequency
  56.       usr = 1
  57.       end
  58.       if frequency == channel2 then
  59.       password = message
  60.       sendChannel2 = replyFrequency
  61.       pswd = 1
  62.       end
  63.     end
  64.   end
  65. end
  66.  
  67. function saveUsers(users)
  68.  
  69. end
  70.  
  71. while true do
  72. getInfo(0, 0)
  73. print(username.." : "..password)
  74. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement