Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --c Zeus S.p.A 2019
- local lbl = "Hotel1"
- local tabr = {}
- local m = peripheral.wrap("top")
- rs.setOutput("left", false)
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function cartaNonValida()
- clear()
- print("Carta non valida o corrotta.")
- print("")
- print("Premere un tasto per uscire")
- os.pullEvent("key")
- os.reboot()
- end
- function cartaVuota()
- clear()
- print("")
- print("Premere un tasto per uscire")
- os.pullEvent("key")
- clear()
- exit()
- end
- clear()
- print("Apri la porta")
- print("")
- print("Inserire la carta")
- m.setInsertCardLight(true)
- za,rawcarta = os.pullEvent("mag_swipe")
- m.setInsertCardLight(false)
- if rawcarta == nil then
- cartaVuota()
- end
- tab = textutils.unserialize(rawcarta)
- if type(tab) ~= "table" then
- cartaNonValida()
- end
- if tab.t ~= "Hotel" then
- cartaNonValida()
- end
- if tab.e ~= "1" and tab.e ~= "sar34" then
- cartaNonValida()
- end
- print("Numero stanza:")
- print(tab.e)
- print("\nCredito rimanente: ")
- print(tab.p)
- print("\nBene hai aperto la porta")
- rs.setOutput("left", true)
- sleep(2)
- rs.setOutput("left", false)
- clear()
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement