Guest User

Untitled

a guest
Jun 1st, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.75 KB | None | 0 0
  1. -- Middle: 25
  2. -- Total: 50
  3. -- 35 : 2 = 15 17
  4.  
  5. term.clear()
  6. term.setCursorPos(8,1)
  7. print("(---------------------------------)")
  8. term.setCursorPos(8,2)
  9. print("(Banking )")
  10. term.setCursorPos(8,3)
  11. print("( System )")
  12. term.setCursorPos(8,4)
  13. print("(---------------------------------)")
  14. term.setCursorPos(8,5)
  15. print("(Are you sure you want to install:)")
  16. term.setCursorPos(8,6)
  17. print("(Banking System V1? )")
  18. term.setCursorPos(8,7)
  19. print("(---------------------------------)")
  20. term.setCursorPos(9,8)
  21. io.write("Answer: ")
  22. answer = read()
  23. if answer == "yes"
  24. then
  25.  
  26. shell.run("rom/programs/mkdir", "DB")
  27. shell.run("rom/programs/mkdir", "DB/DBlog")
  28. shell.run("rom/programs/mkdir", "DB/DBlvl")
  29. shell.run("rom/programs/mkdir", "DB/DBcur")
  30. shell.run("rom/programs/mkdir", "DB/DBmoney")
  31.  
  32.  
  33. -- create admin account *NEW*
  34.  
  35. print("Please enter the admininstrator's login name")
  36. answerone = read()
  37.  
  38. print("And the password")
  39. answertwo = read()
  40.  
  41. -- adding admins data *NEW*
  42.  
  43. file = io.open("DB/DBlog/"..answerone, "w")
  44. file:write(answertwo)
  45. file:close()
  46.  
  47. print("Admin data:")
  48. print("Username: "..answerone)
  49. print("Password: "..answertwo)
  50. -- line 50
  51.  
  52. file = io.open("DB/DBlvl/"..answerone, "w")
  53. file:write("5")
  54. file:close()
  55.  
  56. file = io.open("DB/DBmoney/"..answerone, "w")
  57. file:write("0")
  58. file:close()
  59.  
  60. -- instal startup
  61.  
  62. file = io.open("startup", "w")
  63. file:write('term.clear() \n shell.run("curempty") \n \n shell.run("startuptxt")\n answer = read() \n \n if answer == "create" \n then \n shell.run("create") \n end \n \n if answer == "login" \n then \n shell.run("login") \n if login == "good" \n then \n shell.run("thingy") \n else \n term.setCursorPos(5,8) \n print("bad login") \n term.setCursorPos(5,9) \n sleep(0.5) \n print("Shutting down") \n sleep(1.5) \n os.shutdown() \n end \n end \n \n if answer ~= "login" and answer ~= "create" \n then \n term.setCursorPos(5,8) \n print("You must either answer \'create\' or \'login\'.") \n sleep(2) \n term.setCursorPos(5,9) \n print("Shutting down") \n sleep(1) \n os.shutdown() \n end \n ')
  64. file:close()
  65.  
  66. -- installs main class for new files / functions *NEW* (And more easy to edit files :D)
  67.  
  68. file = io.open("mainclass", "w")
  69. file:write('DBn = io.read("DB/DBcur/name", "r" \n curname = DBn:read() \n DBn:close() \n \n DBl = io.open("DB/DBcur/level", "r") \n curlevel = DBl:read() \n DBl:close() \n DBm = io.open("DB/DBcur/money", "r") \n curmoney = DBm:read() \n DBm:close() \n \n')
  70.  
  71. -- instal money files *ISNT REQUIRED, WONT BE USED (I editted wrong function... so thats also why not used)*
  72.  
  73. -- file = io.open("money", "w")
  74. -- file:write('print("Whos account name do you want to set their balance?") \n answer = read() \n print("How much money?") \n answertwo = read() \n \n file = io.open("DB/DBmoney/"..answer, "w") \n file:write(answertwo) \n file:close() \n \n print("If you did this at yourself relogg to see the update.") \n sleep(2) \n shell.run("thingy")')
  75. -- file:close()
  76.  
  77. -- Admin money administration *NEW*
  78.  
  79. file = io.open("moneyadmin", "w")
  80. file:write('print("Whos account name do you want to set their balance?") \n answer = read() \n print("How much money?") \n answertwo = read() \n \n file = io.open("DB/DBmoney/"..answer, "w") \n file:write(answertwo) \n file:close() \n \n print("If you did this at yourself relogg to see the update.") \n sleep(2) \n shell.run("thingy")')
  81. file:close()
  82.  
  83. -- instal curempty
  84.  
  85.  
  86. file = io.open("curempty", "w")
  87. file:write(' DBcn = io.open("DB/DBcur/name", "w") \n DBcn:close() \n DBcl = io.open("db/DBcur/level", "w") \n DBcl:close() \n ')
  88. file:close()
  89.  
  90. -- instal startuptxt
  91.  
  92.  
  93. file = io.open("startuptxt", "w")
  94. file:write('term.clear() \n term.setCursorPos(5,3) \n print("Do you want to \'login\' or \'create\' a new") \n term.setCursorPos(5,4) \n print("account? Type anything else to shutdown") \n term.setCursorPos(10,5) \n ')
  95. file:close()
  96.  
  97.  
  98. -- instal create
  99.  
  100.  
  101. file = io.open("create", "w")
  102. file:write('term.clear() \n term.setCursorPos(18,3) \n print("Account Creation") \n \n term.setCursorPos(10,8) \n write("Name: ") \n term.setCursorPos(10,10) \n write("Password: ") \n term.setCursorPos(20,8) \n name = read() \n term.setCursorPos(20,10) \n pass = read() \n \n term.setCursorPos(5,12) \n \n dbp = io.open("DB/DBlog/"..name, "r") \n if dbp \n then \n dbp:close() \n print("Username already exists") \n sleep(1) \n term.setCursorPos(5,13) \n print("Shutting down now") \n sleep(1.5) \n os.shutdown() \n else \n dbp = io.open("DB/DBlog/"..name, "w") \n dbp:write(pass) \n dbp: close() \n \n dbm = io.open("DB/DBmoney/"..name, "w") \n dbm:write("0") \n dbm:close() \n \n dbm = io.open("DB/DBmoney/"..name, "w") \n dbm:write("0") \n dbm:close() \n \n dbl = io.open("DB/DBlvl/"..name, "w") \n dbl:write("1") \n dbl:close() \n \n print("New account created. You can now login, login screen is being loaded") \n sleep(1) \n sleep(1.5) \n shell.run("login") \n end \n ')
  103. file:close()
  104.  
  105.  
  106. --instal login
  107.  
  108.  
  109. file = io.open("login", "w")
  110. file:write('term.clear() \n term.setCursorPos(20,3) \n print("Login System") \n term.setCursorPos(1,6) \n \n term.setCursorPos(10,8) \n print("Name: ") \n term.setCursorPos(10,10) \n print("Password: ") \n term.setCursorPos(20,8) \n name = read() \n term.setCursorPos(20,10) \n pass = read() \n \n login = "" \n \n \n \n dbp = io.open("DB/DBlog/" ..name) \n if dbp \n then \n corpass = dbp:read() \n dbp:close() \n if pass == corpass \n then \n login = "good" \n end \n end \n \n sleep(1) \n term.clear() \n term.setCursorPos(20,3) \n print("Login System") \n term.setCursorPos(1,6) \n if login == "good" \n then \n print("login accepted" ) \n end \n \n if login == "good" \n then \n DBcn = io.open("DB/DBcur/name", "w") \n DBcn:write(name) \n DBcn:close() \n \n DBl = io.open("DB/DBlvl/"..name, "r") \n lvl = DBl:read() \n DBl:close() \n \n DBcl = io.open("DB/DBcur/level", "w") \n DBcl:write(lvl) \n DBcl:close() \n DBm = io.open("DB/DBmoney/"..name, "r") \n money = DBm:read() \n DBm:close() \n \n DBcm = io.open("DB/DBcur/money", "w") \n DBcm:write(money) \n DBcm:close() \n \n shell.run("topui") \n shell.run("thingy") \n else \n shell.run("startuptxt") \n end \n \n sleep(1) \n \n ')
  111. file:close()
  112.  
  113.  
  114. --instal topui
  115.  
  116.  
  117. file = io.open("topui", "w")
  118. file:write(' DBm = io.open("DB/DBcur/money", "r") \n curmoney = DBm:read() \n DBm:close() \n \n DBn = io.open("DB/DBcur/name", "r") \n curname = DBn:read() \n DBn:close() \n DBl = io.open("DB/DBcur/level", "r") \n curlvl = DBl:read() \n DBl:close() \n \n term.setCursorPos(1,1) \n term.clearLine() \n write("Current user: "..curname) \n term.setCursorPos(42,1) \n write("level: "..curlvl) \n term.setCursorPos(1,2) \n print("Money: "..curmoney) \n print("-------------------------------------------------") \n ')
  119. file:close()
  120.  
  121.  
  122. --instal thingy
  123.  
  124.  
  125. file = io.open("thingy", "w")
  126. file:write('DBl = io.open("DB/DBcur/level", "r") \n curlvl = DBl:read() \n DBl:close() \n \n while true do \n term.clear() \n shell.run("topui") \n input = read() \n \n if input == "money" \n then \n shell.run("money") \n end \n \n if input == "help" \n then \n shell.run("information") \n end \n \n if input == "moneyadmin" and curlvl=="5" \n then \n shell.run("moneyadmin") \n end \n \n if input == "maintenance" and curlvl=="5" \n then \n break \n end \n \n if input == "delete" \n then \n shell.run("delete") \n end \n \n if input == "set level" \n then \n shell.run("setlvl") \n end \n \n if input == "logout" \n then \n shell.run("logout") \n end \n \n end \n ')
  127. file:close()
  128.  
  129.  
  130. --instal information
  131.  
  132.  
  133. file = io.open("information", "w")
  134. file:write('print("To view this text, type \'help\'") \n print("To quit, type \'logout\'. Be sure to do this when you\'re done.") \n print("To delete an account, type \'delete\'.") \n print("To set an account\'s level, type \'set level\'. You can only change the level of accounts with a lower level than yours and you can only choose a new level that is lower than your level.") \n print("To enter maintenance mode, type \'maintenance\' (only works for the admin account), and moneyadmin to control money!") \n \n print() \n print("Press any key to continue") \n \n while true do \n event = os.pullEvent() \n if event =="char" \n then \n break \n end \n end \n ')
  135. file:close()
  136.  
  137. --instal logout
  138.  
  139.  
  140. file = io.open("logout", "w")
  141. file:write('print("Are you sure you want to log out?") \n sleep(1) \n answer = read() \n if answer == "yes" \n then \n print("Ending session, shutting down in 2 seconds") \n sleep(2) \n os.shutdown() \n else \n print("Log out cancelled") \n sleep(2) \n end \n \n ')
  142. file:close()
  143.  
  144.  
  145. --instal delete
  146.  
  147.  
  148. file = io.open("delete", "w")
  149. file:write('term.clear() \n reqlvl = 3 \n shell.run("topui") \n curlvl = curlvl +1 -1 \n if reqlvl > curlvl \n then \n print("Your level is too low to delete accounts") \n else \n \n term.setCursorPos(20,3) \n print("Account Deletion") \n term.setCursorPos(5,6) \n print("Which account do you want to delete?") \n term.setCursorPos(10,8) \n name = read() \n term.setCursorPos(5,10) \n \n db = io.open("DB/DBlog/"..name,"r" ) \n if db \n then \n db:close() \n shell.run("rom/programs/rm", "DB/DBlog/"..name) \n print("Account deleted") \n else \n print("Username doesn\'t exist.") \n end \n \n end \n \n sleep(2) \n ')
  150. file:close()
  151.  
  152.  
  153. --instal setlvl
  154.  
  155.  
  156. file = io.open("setlvl", "w")
  157. file:write('term.clear() \n shell.run("topui") \n term.setCursorPos(17,4) \n print("Set Clearance level") \n term.setCursorPos(5,6) \n print("Who\'s level do you want to change?") \n term.setCursorPos(10,8) \n name = read() \n term.setCursorPos(5,10) \n print("What do you want to set the level to?") \n term.setCursorPos(10,12) \n level = read() \n term.setCursorPos(5,14) \n sleep(1) \n DBl = io.open("DB/DBlvl/"..name, "r") \n if DBl \n then \n tarlvl = DBl:read() \n DBl:close() \n if curlvl > tarlvl \n then \n if curlvl > level \n then \n DBl = io.open("DB/DBlvl/"..name, "w") \n DBl:write(level) \n DBl:close() \n print(name.."\'s level changed to "..level) \n else \n print("The desired level must be lower than your own") \n end \n else \n print("Target\'s level is too high to be changed") \n end \n else \n print("Name not found") \n end \n \n sleep(2.5) \n \n ')
  158. file:close()
  159.  
  160. --redirecting to login screen
  161.  
  162. print("Redirecting to login screen...")
  163. sleep(2)
  164. shell.run("login")
  165.  
  166. else
  167.  
  168. term.clear()
  169. term.setCursorPos(1,1)
  170.  
  171.  
  172. term.setCursorPos(16,1)
  173. print("(----------------)")
  174. term.setCursorPos(16,2)
  175. print("(Installation )")
  176. term.setCursorPos(16,3)
  177. print("(Aborted )")
  178. term.setCursorPos(16,4)
  179. print("(----------------)")
  180.  
  181. sleep(2)
  182. term.clear()
  183. term.setCursorPos(1,1)
  184. end
Add Comment
Please, Sign In to add comment