Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function headline(title)
- term.setBackgroundColor(colors.black)
- term.clear()
- paintutils.drawLine(1, 1, 52, 1, colors.blue)
- term.setTextColor(colors.orange)
- term.setCursorPos(1, 1)
- print(title)
- term.setCursorPos(24,1)
- print("v1.0")
- term.setCursorPos(39, 1)
- print("by MagicMarky")
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- end
- function centerText(text, y)
- local sx, sy = term.getSize()
- term.setCursorPos(math.ceil((sx/2)-(#text)/2), y)
- print(text)
- end
- function start()
- headline("MMTL System")
- --Felder
- paintutils.drawPixel(2, 3, colors.lime)
- paintutils.drawPixel(2, 5, colors.lime)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(4, 3)
- print("Login")
- term.setCursorPos(4, 5)
- print("TåBCr åB6ffnen")
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- if x >= 2 and x <= 8 and y == 3 then
- login()
- break
- elseif x >= 2 and x <= 14 and y == 5 then
- passwort()
- break
- end
- end
- end
- username = ""
- password = ""
- function login()
- rednet.open("back")
- headline("MMTL Login")
- --Username/Passwort
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.cyan)
- term.setCursorPos(14, 6)
- print("Username: ")
- term.setCursorPos(14, 7)
- print("Passwort: ")
- --Abfrage
- term.setTextColor(colors.yellow)
- term.setCursorPos(24, 6)
- username = read()
- term.setCursorPos(24, 7)
- password = read("*")
- local msg = "LOGIN " .. username .. ":" .. password
- rednet.send(62, msg)
- local ret = "N/A"
- while true do
- id, ret = rednet.receive(10)
- if id == nil then
- break
- elseif id == 62 then
- if ret == "USER_NOT_EXISTS" or ret == "RIGHT_PASSWORD" or ret == "WRONG_PASSWORD" then
- break
- end
- end
- end
- if ret == "RIGHT_PASSWORD" then
- term.setTextColor(colors.lime)
- centerText("Logging in..", 14)
- os.sleep(2)
- interface()
- elseif ret == "WRONG_PASSWORD" then
- term.setTextColor(colors.red)
- centerText("Passwort falsch!", 14)
- os.sleep(2)
- login()
- elseif ret == "USER_NOT_EXISTS" then
- term.setTextColor(colors.red)
- centerText("User nicht vorhanden!", 14)
- os.sleep(2)
- login()
- elseif ret == "N/A" then
- term.setTextColor(colors.red)
- centerText("Keine Antwort vom Server!", 14)
- os.sleep(2)
- login()
- end
- end
- function interface()
- headline("MMTL Interface")
- --Felder
- paintutils.drawPixel(2, 3, colors.lime)
- paintutils.drawPixel(2, 5, colors.lime)
- paintutils.drawPixel(42, 18, colors.red)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(4, 3)
- print("Mail")
- term.setCursorPos(4, 5)
- print("Hello World")
- term.setCursorPos(44, 18)
- print("Logout")
- --Click
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- if x >= 2 and x <= 7 and y == 3 then
- mail()
- break
- elseif x >=2 and x <= 14 and y == 5 then
- term.clear()
- headline("MMTL Interface")
- term.setCursorPos(1, 3)
- shell.run("hello")
- os.sleep(1)
- interface()
- break
- elseif x >= 42 and x <= 49 and y == 18 then
- os.reboot()
- break
- end
- end
- end
- function mail()
- rednet.open("back")
- headline("MMTL Mail")
- --Click
- function posteingang()
- term.clear()
- headline("MMTL Mail")
- paintutils.drawPixel(2, 3, colors.lime)
- paintutils.drawPixel(2, 5, colors.lime)
- paintutils.drawPixel(42, 18, colors.red)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(4, 3)
- print("Posteingang")
- term.setCursorPos(4, 5)
- print("E-Mail senden")
- term.setCursorPos(44, 18)
- print("ZuråBCck")
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- if x >=2 and x <= 14 and y == 3 then
- -- Mail Abrufen
- headline("MMTL Mail")
- term.setTextColor(colors.yellow)
- centerText("Checking..", 9)
- receive()
- --ZuråBCck
- paintutils.drawPixel(42, 18, colors.red)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(44, 18)
- print("ZuråBCck")
- zurueck()
- break
- elseif x >= 42 and x <= 49 and y == 18 then
- interface()
- break
- elseif x >= 2 and x <= 16 and y == 5 then
- headline("MMTL Mail")
- term.setTextColor(colors.lime)
- term.setCursorPos(1, 3)
- print("An: ")
- print("Nachricht: ")
- term.setTextColor(colors.white)
- term.setCursorPos(5, 3)
- local ziel = read()
- term.setCursorPos(12, 4)
- local input = read()
- term.setTextColor(colors.yellow)
- centerText("Sending...", 9)
- term.setTextColor(colors.yellow)
- send(ziel, input)
- local ret = "N/A"
- while true do
- id, ret = rednet.receive(5)
- if id == nil then
- break
- elseif id == 62 then
- if ret == "SUCCESSFUL_SENT" or ret == "FAILED_SENT" then
- break
- end
- end
- end
- sleep(2)
- if id == nil then
- headline("MMTL Mail")
- term.setTextColor(colors.red)
- centerText("Keine Antwort vom Server!", 9)
- sleep(1.5)
- else
- if ret == "SUCCESSFUL_SENT" then
- headline("MMTL Mail")
- term.setTextColor(colors.yellow)
- centerText("Successfully sent", 9)
- sleep(1.5)
- elseif ret == "TARGET_NOT_EXISTS" then
- headline("MMTL Mail")
- term.setTextColor(colors.red)
- centerText("User nicht vorhanden!", 9)
- sleep(1.5)
- elseif ret == "FAILED_SENT" then
- headline("MMTL Mail")
- term.setTextColor(colors.red)
- centerText("E-Mail senden gescheitert!", 9)
- sleep(1.5)
- end
- end
- mail()
- break
- end
- end
- end
- function zurueck()
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- if x >= 42 and x <= 49 and y == 18 then
- posteingang()
- break
- end
- end
- end
- function receive()
- while true do
- local id, msg = rednet.receive(1.5)
- headline("MMTL Mail")
- term.setCursorPos(2, 3)
- print(msg)
- break
- end
- end
- function send(ziel, input)
- local nachricht = "SEND " .. username .. ":" .. password .. " ".. ziel .." " .. input
- rednet.send(62, nachricht)
- end
- posteingang()
- end
- function passwort()
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setTextColor(colors.blue)
- term.setCursorPos(1, 3)
- print("---------------------------------------------------")
- print(" ")
- centerText("Willkommen in der Zentrale von", 5)
- print(" ")
- centerText("Michi, Lu, Tim und Markus!", 7)
- print(" ")
- print("---------------------------------------------------")
- term.setTextColor(colors.gray)
- term.setCursorPos(1, 19)
- print("(Hacken ist nicht måB6glich)")
- term.setCursorPos(1, 16)
- term.setTextColor(colors.lime)
- write("Bitte Passwort eingeben: ")
- term.setTextColor(colors.yellow)
- passwort = read("*")
- if passwort == " lutschn " then
- rs.setOutput("bottom", true)
- term.setTextColor(colors.lime)
- term.setCursorPos(1, 16)
- term.clearLine()
- term.setCursorPos(1, 18)
- term.clearLine()
- term.setCursorPos(23, 13)
- print(" + ")
- term.setCursorPos(23, 14)
- print(" + ")
- term.setCursorPos(23, 15)
- print(" + + ")
- term.setCursorPos(23, 16)
- print(" + ")
- os.sleep(2)
- rs.setOutput("bottom", false)
- elseif passwort == "zu" then
- rs.setOutput("bottom", false)
- term.setTextColor(colors.lightGray)
- term.setCursorPos(1, 16)
- term.clearLine()
- term.setCursorPos(1, 18)
- term.clearLine()
- term.setCursorPos(23, 12)
- print(" ++ ")
- term.setCursorPos(23, 13)
- print(" + + ")
- term.setTextColor(colors.orange)
- term.setCursorPos(23, 14)
- print(" ++++++ ")
- term.setCursorPos(23, 15)
- print(" ++++++ ")
- term.setCursorPos(23, 16)
- print(" ++++++ ")
- os.sleep(2)
- else
- local file = fs.open("log", fs.exists("log") and "a" or "w")
- file.writeLine(passwort)
- file.close()
- term.setTextColor(colors.red)
- term.setCursorPos(1, 16)
- term.clearLine()
- term.setCursorPos(1, 18)
- term.clearLine()
- term.setCursorPos(23, 12)
- print("+ +")
- term.setCursorPos(23, 13)
- print(" + + ")
- term.setCursorPos(23, 14)
- print(" + ")
- term.setCursorPos(23, 15)
- print(" + + ")
- term.setCursorPos(23, 16)
- print("+ +")
- os.sleep(2)
- end
- start()
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement