Advertisement
PappleFruit

Check-PC V1.0

Jul 27th, 2013
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. local pullEvent = os.pullEvent
  2.  
  3. --Change the 2 to the ID of the PC, that is logging in
  4. local pc = 2
  5.  
  6. os.pullEvent = os.pullEventRaw
  7.  
  8. term.clear()
  9. term.setCursorPos(1,1)
  10.  
  11. --Change back to the side of the modem on the computer
  12. rednet.open("back")
  13.  
  14. local usernames = {"Peter", "John"}
  15. local passwords = {"1.40205969E14", "1.51645397E14"}
  16.  
  17. id, user = rednet.receive()
  18. id, pass = rednet.receive()
  19.  
  20. local num  = ""
  21. local num3 = 0
  22.  
  23. for char in pass:gmatch(".") do
  24.   num2 = (("0"):rep(3 - #tostring(string.byte(char))) .. string.byte(char))
  25.   num  = num .. num2
  26.   num3 = num3 + num2
  27. end
  28.  
  29. num = tonumber(num)
  30.  
  31. num = num + num3 - 12.64392709*num3
  32. num = num*2.78834729/0.97548326
  33.  
  34. num = tostring(num)
  35.  
  36. if user == "Terminate" and num == "191792163723692480" then
  37.   rednet.send(pc, "Termination")
  38.   os.pullEvent = pullEvent
  39.   sleep(30)
  40. end
  41.  
  42. for loop = 1, #usernames do
  43.   if user == usernames[loop] and num == passwords[loop] then
  44.     rednet.send(pc, "ok")
  45.   end
  46. end
  47.  
  48. rednet.send(pc, "not ok")
  49.  
  50. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement