Advertisement
willwac

DuoStep - CLIENT

Sep 7th, 2013
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.99 KB | None | 0 0
  1. --DuoStep Client v0.2
  2. --Please use the installer to download DuoStep v0.1; The installer is located at: http://pastebin.com/RdPg0Rmr
  3. --(c)2013 NewCoolPC, willwac, and Thy.me Programs
  4. clientVer = "0.2"
  5. local isTrue = 2021185
  6. local isFalse = 6112195
  7. local function menu()
  8. --Config
  9. local side = "top"
  10. local sID = 2
  11.  
  12. rednet.open( side )
  13. local id = os.getComputerID()
  14. --local validVer = {"ver",clientVer}
  15. --rednet.send(sID,validVer)
  16. term.setBackgroundColor(colors.white)
  17. term.clear()
  18. term.setCursorPos(1,1)
  19. term.setTextColor(colors.black)
  20. print("Please click on the player detector.")
  21. local p = nil
  22. while p == nil do
  23.   event, p = os.pullEvent("player")
  24. end
  25. event = nil
  26. term.clear()
  27. term.setCursorPos(1,1)
  28. print("Requesting Validation check...")
  29. local plr = {"player",p}
  30. rednet.send(sID,plr)
  31. local sndr, isValid = rednet.receive(3)
  32. if isValid == isFalse then
  33. printError(p.." is not allowed on the computers.")
  34. menu()
  35. elseif isValid == isTrue then
  36. print("Username: "..p)
  37. print("Please enter in your password below.")
  38. print(" ")
  39. term.write("Password: ")
  40. local pass = read("*")
  41. local x,y=term.getCursorPos()
  42. term.setCursorPos( 1,y+1 )
  43. x,y = nil
  44. print("Requesting Validation check...")
  45. local cred = {"login",p,pass}
  46. rednet.send(sID, cred)
  47. sndr, isValid = rednet.receive(3)
  48. if isValid == isFalse then
  49. printError("Incorrect Password.")
  50. sleep(3)
  51. menu()
  52. elseif isValid == isTrue then
  53. term.clear()
  54. term.setCursorPos(1,1)
  55. print("Welcome, "..p.."!")
  56. print("")
  57. print("Menu:")
  58. --print("1: Change Password")
  59. --print("2: Delete Account*")
  60. print("3: Log out")
  61. print("4: Shutdown")
  62. print("5: CraftOS")
  63. print("")
  64. term.write(">")
  65. local option = read()
  66. --if read == "1" then
  67.   --term.clear()
  68.   --term.setCursorPos(1,1)
  69.   --print("Change Password:")
  70.   --print("")
  71.   --term.write("Old Password: ")
  72.   --local pass = read("*")
  73.   --local x,y = term.getCursorPos()
  74.   --term.setCursorPos(1,y+2)
  75.   --term.write("New Password: ")
  76.   --local npass = read("*")
  77.   --term.setCursorPos(y+3)
  78.   --term.write("Again: ")
  79.   --local npv = read("*")
  80.   --if npass ~= npv then
  81.     --menu()
  82.   --else
  83.     --local ps = {"change",p,pass,npass}
  84.     --local sndr, stat = rednet.receive(10)
  85.     --if stat == isFalse then
  86.       --printError("Failure")
  87.       --sleep(3)
  88.       --menu()
  89.     --elseif stat == isTrue then
  90.       --print("Pass Changed.")
  91.       --sleep(3)
  92.       --menu()
  93.     --end
  94.   --end
  95. --elseif option == "2" then
  96.   --term.clear()
  97.   --term.setCursorPos(1,1)
  98.   --print("Your admin must enter in their password.")
  99.   --print("Have admin click on player detector.")
  100.   --ap = nil
  101.   --while ap == nil do
  102.     --event, ap = os.pullEvent("player")
  103.     --event = nil
  104.   --end
  105.   --print("Validating Player...")
  106.   --local admin = {"delete",ap}
  107.   --rednet.send(sID, admin)
  108.   --local sndr, isAdmin = rednet.receive(3)
  109.   --if isAdmin == isFalse then
  110.     --printError(admin.." is not the admin.")
  111.     --sleep(3)
  112.     --menu()
  113.   --elseif isAdmin == isTrue then
  114.     --print("Delete "..p.."'s account?")
  115.     --term.write(":")
  116.     --local cmd = read(" ")
  117.     --local x,y = term.getCursorPos()
  118.     --term.setCursorPos(1,y+1)
  119.     --if cmd == "grate" then
  120.       --print(p..", enter in your pass.")
  121.       --term.write(">")
  122.       --local dpass = read("*")
  123.       --local del = {"delconf",p,dpass}
  124.       --rednet.send(sID,del)
  125.       --print("Getting response...")
  126.       --local sndr, conf = rednet.receive()
  127.       --if conf == isTrue then
  128.         --printError(p.."'s Account has been deleted.")
  129.         --menu()
  130.       --elseif conf == isFalse then
  131.         --print(p.."'s Account has NOT been deleted.")
  132.         --menu()
  133.       --end
  134.    --else
  135.    --menu()
  136.    --end
  137. --end
  138.   if option == "3" then
  139.     menu()
  140.   elseif option == "4" then
  141.     os.shutdown()
  142.   elseif option == "5" then
  143.     term.setBackgroundColor(colors.black)
  144.     term.setTextColor(colors.white)
  145.     term.clear()
  146.     term.setCursorPos(1,1)
  147.     return
  148.   else
  149.     printError("Not a valid option.")
  150.     sleep(4)
  151.     menu()
  152.   end
  153.  end
  154. end
  155. end
  156. menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement