Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("top")
- local function cPrint(text)
- local x,y = term.getSize()
- local x2,y2 = term.getCursorPos()
- term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
- print(text)
- end
- server = 185
- lock = false
- op[1] = "#"
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print()
- cPrint("=== Nova National Bank ATM ===")
- cPrint("=== Welcome! ===")
- print()
- cPrint("Please press the 'Enter' key to log in")
- local sEvent, param = os.pullEvent("key")
- if sEvent == "key" and param == 28 then
- rednet.send(server, "login")
- server2, message, distance = rednet.receive()
- if message == "SessionLock" then
- lock = true
- end
- end
- print(lock)
- while lock do
- server2, message, distance = rednet.receive()
- if message == "pUsername" then
- cPrint("Please Enter your Username")
- user = read()
- rednet.send(server, user)
- end
- if message == "pPassword" then
- cPrint("Please enter your Password")
- pass = read("*")
- rednet.send(server, pass)
- end
- if message == "Auth" then
- cPrint("User Authenticated. Welcome " .. user .. "!")
- auth = true
- end
- while auth do
- cPrint(" === Nova National Bank ATM === ")
- cPrint("=== Welcome " .. user .. "!")
- print("")
- cPrint("Use the arrow keys to navigate through the menu")
- print("")
- cPrint( op[1] .. " Check your Balance.")
- cPrint( op[2] .. "Withdraw Funds.")
- cPrint( op[3] .. "Deposit Funds.")
- cPrint( op[4] .. "Transfer Funds.")
- cPrint( op[5] .. "Transaction History")
- cPrint( op[6] .. "User Settings.")
- cPrint( op[7] .. "Logout")
- local sEvent, param = os.pullEvent("key")
- if sEvent == "key" and (param == 200 or param == 264 then
- op[mainMen] = ""
- if mainMen == 1 then
- mainMen = 7
- else
- mainMen = mainMen - 1
- end
- op[mainMen] = "#"
- elseif sEvent == "key" and (param == 208 or param == 265) then
- op[mainMen] = ""
- if mainMen == 7 then
- mainMen = 1
- else
- mainMen = mainMen + 1
- end
- op[mainMen] = "#"
- end
- if sEvent == "key" and (param == 28 or param == 256) then
- runP(mainMen)
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment