Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modem = peripheral.wrap("top")
- usersApp = fs.open("users", "a")
- term.clear()
- term.setCursorPos(1, 1)
- users = {}
- channel1 = 4826
- channel2 = 3984
- function openPort(port)
- if not modem.isOpen(port) then modem.open(port)
- end
- end
- args = {...}
- if args[1] == "-mkuser" and #args < 3 then
- print("You are missing arguments.")
- os.reboot()
- end
- if args[1] == "-mkuser" and #args == 3 then
- users[#users+1] = args[2].." "..args[3]
- print("User successfully created!")
- os.reboot()
- end
- if args[1] == "-delUsers" and args[2] == "u778p" then
- usersApp = fs.open("users", "w")
- usersApp.write("")
- end
- function reset()
- term.clear()
- term.setCursorPos(1, 1)
- end
- print("Booting")
- sleep(0.5)
- reset()
- print("Booting.")
- sleep(0.5)
- reset()
- print("Booting..")
- sleep(0.5)
- reset()
- print("Booting...")
- sleep(1)
- reset()
- openPort(channel1)
- openPort(channel2)
- function getInfo(usr, pswd)
- while usr == 0 or pswd == 0 do
- event, side, frequency, replyFrequency,
- message, distance =
- os.pullEvent("modem_message")
- if event == "modem_message" then
- if frequency == channel1 then
- username = message
- sendChannel1 = replyFrequency
- usr = 1
- end
- if frequency == channel2 then
- password = message
- sendChannel2 = replyFrequency
- pswd = 1
- end
- end
- end
- end
- function saveUsers(username, password)
- usersApp.writeLine(username.." "..password)
- usersApp.flush()
- end
- while true do
- getInfo(0, 0)
- saveUsers(username, password)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement