Advertisement
Muzze77

Muzze JobScript V1.0

Jun 10th, 2014
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.45 KB | None | 0 0
  1. --BauJob
  2. list = {
  3. }
  4.  
  5.     function cut()
  6.         sleep(3)
  7.         shell.run("clear")
  8.         sleep(1)
  9.     end
  10. function beenden()
  11. --
  12. end  
  13. function load()
  14.         shell.run("clear")
  15.         print("     Bitte Usernamen eingeben: ")
  16.         user = io.read()
  17.         dem = fs.exists(user)
  18.             if dem == true then
  19.                             rfile = fs.open(user, "r")
  20.                             a = rfile.readLine(1)
  21.                             b = rfile.readLine(2)
  22.                             rfile.close()
  23.            
  24.                         if user == a then
  25.                             print("     Bitte Password eingeben")
  26.                             pass = read("*")   
  27.                                 if pass == b then
  28.                                     print("Password Akzeptiert")
  29.                                     cut()
  30.                                     print("Den Job wirklich beenden ? ")
  31.                                     print("[J] Ja | [N] Nein")
  32.                                    
  33.                                     local evt, key2 = os.pullEvent("char")
  34.                                     key2 = string.lower(key2)
  35.                                         if key2 == "j" then
  36.                                         beenden()
  37.                                         elseif key2 == "n" then
  38.                                         shell.run("reboot")
  39.                                         end
  40.                                 else
  41.                                     print("     Falsches Passwort")
  42.                                     sleep(2)
  43.                                 end
  44.                         else
  45.                             print("     Falscher Username")
  46.                             sleep(2)
  47.                            
  48.                            
  49.                         end
  50.             elseif dem == false then
  51.             print("     Der Account " .. user .. " exsistiert nicht")
  52.             sleep(2)
  53.            
  54.             end
  55. end
  56.    
  57.    
  58. function new()
  59.         cut()
  60.    
  61.         print("     Namen Eingeben :")
  62.                 Name = io.read()
  63.                 if fs.exists(Name) then
  64.                     print("     Account existiert bereits")
  65.                     print("     Bitte waehlen Sie einen anderen Accountnamen")
  66.                    
  67.                 else
  68.                     print("Name " .. Name .. " gewaehlt")
  69.                     sleep(2)
  70.                     cut()
  71.                     print("Password Eingeben:")
  72.                     Password = read("*")
  73.                     cut()
  74.                     print("Alter angeben:")
  75.                     Age = io.read()
  76.                     Age = tonumber(Age)
  77.                     acc = {}
  78.                     acc.Name = {}
  79.                     acc.Name.Name = Name
  80.                     acc.Name.Password = Password
  81.                     acc.Name.Age = Age
  82.                     file = fs.open(Name, "w")
  83.                     file.writeLine(acc.Name.Name)
  84.                     file.writeLine(acc.Name.Password)
  85.                     file.writeLine(acc.Name.Age)
  86.                     file.close()
  87.                     table.insert(list, Name)
  88.                     table.insert(list, Name.Name)
  89.                     table.insert(list, Name.Age)
  90.                     print(" Done!")
  91.                     print(" Name: " .. acc.Name.Name .. " Account erstellt.")
  92.                     sleep(2)
  93.                     cut()
  94.                 end
  95. end            
  96.  
  97.  
  98. function test()
  99.  
  100.  
  101. for m, k in pairs (list) do
  102. local evt, key2 = os.pullEvent("key")
  103.             key2 = string.lower(key2)
  104. if key2 == 28 then
  105. print(k)
  106. print(k.Name)
  107. print(k.Age)
  108. else
  109.  
  110. end
  111. end
  112. end
  113.  
  114.  
  115.  
  116. function masterkey()
  117. cut()
  118. print("Masterkey Eingeben: ")
  119. term.setCursorPos(21, 1)
  120. mkey = read("*")
  121. if mkey == "daremon22" then
  122. term.setCursorPos(1,2)
  123. print("Password akzepiert")
  124. cut()
  125. test()
  126. else
  127. term.setCursorPos(1,2)
  128. print("Falsches Password")
  129. cut()
  130. end
  131.  
  132.  
  133.  
  134. end
  135.  
  136.    
  137.  
  138.  
  139.         function LoadNew()
  140.         local evt, key1 = os.pullEvent("char")
  141.             key1 = string.lower(key1)
  142.             if key1 == "l" then
  143.             load()
  144.             elseif key1 == "n" then
  145.             new()
  146.             elseif key1 == "m" then
  147.             masterkey()
  148.             end
  149. end
  150.  
  151. function TerminalStart()
  152.         local evt, key = os.pullEvent("char")
  153.         key = string.lower(key)
  154.         if key == "w" then
  155.             cut()
  156.             print("     Bitte waehle eine Aktion:\n     [L]Benutzer Laden - Job aufgeben\n      [N]Neuer User - Bewerbung\n     [M] Masterkey - Muzze77")
  157.             LoadNew()
  158.         end
  159.        
  160. end
  161.     function start()
  162.     shell.run("clear")
  163.     sleep(0.2)
  164.     term.setBackgroundColor(colors.blue)
  165.     term.setTextColor(colors.white)
  166.     shell.run("clear")
  167.     sleep(0.2)
  168.     print("   Willkommen bei der Anmeldung für Manarolas Jobs")
  169.     print("         Mit W zugriff aufs Terminal")
  170.     TerminalStart()
  171.    
  172. end
  173.  
  174.    
  175.  
  176. while true do
  177.  
  178. start()
  179.  
  180. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement