Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- serverID = 3604
- serverName = "EpicServer"
- serverPass = "smiggerryan12"
- if not fs.exists("db") then
- downloadDB = http.get("http://pastebin.com/raw.php?i=SfXFSh0a")
- downloadDBView = downloadDB.readAll()
- downloadDB.close()
- writeDB = fs.open("db", "w")
- writeDB.write(downloadDBView)
- writeDB.close()
- os.loadAPI("db")
- elseif fs.exists("db") then
- os.loadAPI("db")
- end
- x, y = term.getSize()
- function centered(str, height)
- term.setCursorPos(x / 2 - #str / 2, height)
- term.write(str)
- end
- function indented(str, indent, height)
- term.setCursorPos(indent, height)
- term.write(str)
- end
- function left(str, height)
- term.setCursorPos(1, height)
- term.write(str)
- end
- function right(str, height)
- term.setCursorPos(x - #str, height)
- end
- function clearLine(colour, height)
- term.setCursorPos(1, height)
- term.setBackgroundColour(colours[colour])
- term.clearLine()
- end
- function doorLock()
- while true do
- rednet.open("back")
- term.setBackgroundColour(colours.cyan)
- term.clear()
- term.setTextColour(colours.lightBlue)
- clearLine("blue", 1)
- clearLine("blue", 2)
- clearLine("blue", 3)
- indented("EpicCo", 2, 2)
- term.setBackgroundColour(colours.cyan)
- indented("Username: ", 2, 6)
- indented("Password: ", 2, 8)
- term.setCursorPos(12, 6)
- usernameAuth = read()
- term.setCursorPos(12, 8)
- passwordAuth = read("*")
- if db.checkUser(serverID, serverName, serverPass, usernameAuth, passwordAuth) then
- rs.setOutput("bottom", true)
- sleep(5)
- rs.setOutput("bottom", false)
- end
- end
- end
- function pocketOpen()
- while true do
- rednet.open("back")
- local id, msg, dis = rednet.receive()
- if type(msg) == "table" and msg.username and msg.password then
- if db.checkUser(serverID, serverName, serverPass, msg.username, msg.password) then
- rs.setOutput("bottom", true)
- sleep(5)
- rs.setOutput("bottom", false)
- end
- end
- end
- end
- term.clear()
- parallel.waitForAny(doorLock, pocketOpen)
Advertisement
Add Comment
Please, Sign In to add comment