Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local w, h = term.getSize()
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- local idPC = os.getComputerID()
- if fs.exists("/C/system/.core/defmodem") then
- local data = fs.open ("/C/system/.core/defmodem","r")
- modemPos = data.readLine()
- data.close()
- if not modemPos then
- modemPos = "offline"
- else
- modem.open(idPC)
- end
- else
- modemPos = "offline"
- end
- function restarting ()
- term.setBackgroundColor(colors.lightGray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.gray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.black)
- term.clear()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(w/2-6, h/2)
- write "Restarting..."
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(w/2-5,h-1)
- write " Pepek"
- term.setCursorPos(w/2+3,h-1)
- write "Soft "
- term.setCursorPos(w/2+2,h-1)
- term.setTextColor(colors.lime)
- write "@"
- sleep(1)
- os.reboot ()
- end
- function start()
- term.setCursorPos(1,1)
- write"ID serveru: "
- ID = tonumber(read())
- term.setCursorPos(1,2)
- write"User: "
- user = read()
- term.setCursorPos(1,3)
- write"Pass: "
- pass = read()
- dotaz()
- end
- rfreq = 0
- i = 0
- function prijmout()
- timerRX = os.startTimer(2)
- while true do
- local event,p1,p2,p3,p4 = os.pullEvent()
- if event == ("modem_message") then
- print("Odpoved serveru "..p4)
- if (p3 == 552) then
- if (p4 == "true") then
- local c = fs.open ("/C/system/.core/AD", "w")
- c.writeLine(tostring(ID))
- c.close()
- restarting()
- else
- print"error"
- end
- end
- sleep(1)
- shell.run("/C/desktop.lua")
- elseif event == "timer" then
- if p1 >= timerRX then
- shell.run("/C/desktop.lua")
- end
- end
- end
- end
- function dotaz()
- modem.open(idPC)
- modem.transmit(tonumber(ID),550,idPC)
- modem.transmit(tonumber(ID),551,user)
- modem.transmit(tonumber(ID),552,pass)
- prijmout()
- end
- start()
Add Comment
Please, Sign In to add comment