Advertisement
systox

Notepad

Jul 21st, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.97 KB | None | 0 0
  1. -- Clear-System
  2. function cc()
  3. term.clear()
  4. term.setCursorPos(1,1)
  5. end
  6.  
  7. function gui(name)
  8. cc()
  9. print("--------------------------------------------------")
  10. print("                 Fontania-Messages                ")
  11. print("--------------------------------------------------")
  12. term.setCursorPos(1,19)
  13. write("Willkommen "..name.."!")
  14. term.setCursorPos(1,4)
  15. end
  16.  
  17. function befehl(name)
  18. write("Befehl: ")
  19. Befehl = io.read()
  20.  
  21. if Befehl == "help" == true then
  22. gui(name)
  23. print("Herunterfahren:                           shutdown")
  24. print("Neustarten:                                 reboot")
  25. print("Abmelden:                                  singout")
  26. print("Bericht Erstellen:                             new")
  27. print("Bericht liste:                                list")
  28. print("Bericht Oeffnen                               open")
  29. print("Gebannte spieler liste              Banned-players")
  30. print()
  31. befehl(name)
  32.  
  33. elseif Befehl == "shutdown" == true then
  34. os.shutdown()
  35.  
  36. elseif Befehl == "reboot" == true then
  37. os.reboot()
  38.  
  39. elseif Befehl == "singout" == true then
  40. shell.run("Stadt")
  41.  
  42. elseif Befehl == "list" == true then
  43. gui(name)
  44.  local files = fs.list(shell.dir())
  45.  for i,file in pairs(files) do
  46.   if fs.isDir(file) then
  47.    if file == "Users" == false then
  48.     if file == "rom" == false then
  49.      print("[Thema] "..file)
  50.     end
  51.    end
  52.   else
  53.  if file == "Stadt" == false then
  54.   if file == "edit.lua" == false then
  55.    if file == "startup" == false then
  56.    print("[Artikel] "..file)
  57.     end
  58.    end
  59.   end
  60.  end
  61. end
  62. write("Artikel Oeffnen: ")
  63. local input = io.read()
  64. if fs.exists(input) == true then
  65. else
  66. textutils.slowPrint("Dieser Artikel existiert nicht!")
  67. end
  68.  
  69. elseif Befehl == "new" == true then
  70.    gui(name)
  71.    write("Betreff: ")
  72.    Betreff = io.read()
  73.    shell.run("edit.lua ("..name.."):"..Betreff)
  74.  
  75. elseif Befehl == "Banned-players" == true then
  76.  local files = fs.list(shell.dir())
  77.  for i,file in pairs(files) do
  78.  if fs.isDir(file) == false then
  79.  print("[File] "..file)
  80.  end
  81.  end
  82.  
  83.  elseif Befehl == "open" == true then
  84.  cc()
  85.  gui(name)
  86.  shell.run("edit.lua")
  87.  end
  88. end
  89.  
  90. -- Login-System
  91. function login(name)
  92. gui(name)
  93. write("Bei Hilfe 'help' eingeben!")
  94. term.setCursorPos(1,6)
  95.  
  96. befehl(name)
  97. end
  98.  
  99. -- Funktion für den falschen User
  100. function falseUser()
  101. print("Falscher User!")
  102. sleep(1)
  103. os.reboot()
  104. end
  105.  
  106. -- User-Registrierung
  107. function register(name,passwort,berechtigung)
  108. filesave(name,name)
  109. end
  110.  
  111. function filesave(name,folder,message)
  112. fs.makeDir("Users/"..folder)
  113. f = fs.open("Users/"..folder..""..name,"w")
  114. f.write(message)
  115. f.close()
  116. end
  117.  
  118. function main()
  119. --  Input-abfrage
  120. write"Name/Kennung: "
  121. input = io.read()
  122.   if fs.exists("Users/"..input) then
  123.   login(input)
  124.   else
  125.   falseUser()
  126.  end
  127. end
  128.  
  129. --  Startdateien werden vorbereitet!
  130. if fs.exists("Users/Admin") == false then
  131.  fs.makeDir("Artikel")
  132.  fs.makeDir("Users")
  133.  fa = fs.open("Users/Admin","w")
  134.  fa.write("Account!")
  135.  fa.close()
  136. end
  137.  
  138. cc()
  139. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement