Advertisement
Guest User

Salut

a guest
Aug 8th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.30 KB | None | 0 0
  1. -- Systeme de securite EzKliks v0.1
  2.  
  3. -- Variable
  4. local accesvip = "etekt1ex"
  5.  
  6. -- function
  7. function initLigne()
  8.     xLigne = 2
  9. end
  10.  
  11. function addligne()
  12.     xLigne = xLigne + 1
  13.     term.setCursorPos(2, xLigne)
  14. end
  15.  
  16. function clearCommand()
  17.     term.setCursorPos(2, 18)
  18.     print("                                                  ")
  19. end
  20.  
  21. function initMenu()
  22.     term.setBackgroundColor(colors.gray)
  23.     term.setTextColor(colors.white)
  24.     term.clear()
  25.     h = fs.open("fileUser", "r")
  26.     prenom = h.readAll()
  27.     h.close()
  28.     term.setCursorPos(1,1)
  29.     print(" EzKliksOS                    user : " .. prenom .. "               ")
  30.     term.setBackgroundColor(colors.cyan)
  31.     term.setCursorPos(2,2)
  32.     print("                                                  ")
  33.     term.setCursorPos(2,3)
  34.     print("                                                  ")
  35.     term.setCursorPos(2,4)
  36.     print("                                                  ")
  37.     term.setCursorPos(2,5)
  38.     print("                                                  ")
  39.     term.setCursorPos(2,6)
  40.     print("                                                  ")
  41.     term.setCursorPos(2,7)
  42.     print("                                                  ")
  43.     term.setCursorPos(2,8)
  44.     print("                                                  ")
  45.     term.setCursorPos(2,9)
  46.     print("                                                  ")
  47.     term.setCursorPos(2,10)
  48.     print("                                                  ")
  49.     term.setCursorPos(2,11)
  50.     print("                                                  ")
  51.     term.setCursorPos(2,12)
  52.     print("                                                  ")
  53.     term.setCursorPos(2,13)
  54.     print("                                                  ")
  55.     term.setCursorPos(2,14)
  56.     print("                                                  ")
  57.     term.setCursorPos(2,15)
  58.     print("                                                  ")
  59.     term.setCursorPos(2,16)
  60.     print("                                                  ")
  61.     term.setBackgroundColor(colors.gray)
  62.     term.setCursorPos(2,17)
  63.     print("                                                  ")
  64.     term.setBackgroundColor(colors.cyan)
  65.     term.setCursorPos(2,18)
  66.     print("                                                  ")
  67.     term.setCursorPos(2,2)
  68.     rednet.open("left")
  69. end
  70.  
  71. function command()
  72.     while true do
  73.     local typeResult = nil
  74.     term.setCursorPos(2, 18)
  75.     typeResult = read()
  76.     term.setCursorPos(2, xLigne)
  77.     if typeResult == "shutdown" then
  78.         sleep(0.5)
  79.         os.shutdown()
  80.     elseif typeResult == "help" then
  81.         sleep(0.1)
  82.         print("commands : clear - reboot - help - shutdown")
  83.     elseif typeResult == "clear" then
  84.         sleep(0.5)
  85.         initMenu()
  86.         initLigne()
  87.     elseif typeResult == "SuperAdmin" then
  88.         write("Password : ")
  89.         pswd = read("*")
  90.         if pswd == accesvip then
  91.         term.setBackgroundColor(colors.black)
  92.         term.setTextColor(colors.white)
  93.         term.clear()
  94.         term.setCursorPos(1,1)
  95.         break
  96.         end
  97.     elseif typeResult == "reboot" then
  98.         sleep(0.5)
  99.         os.reboot()
  100.     else
  101.         sleep(0.1)
  102.         print("Commande inconnue, tapez 'help'")
  103.     end
  104.     clearCommand()
  105.     addligne()
  106.     end
  107. end
  108.  
  109. function connexion()
  110.     term.setBackgroundColor(colors.cyan)
  111.     term.setTextColor(colors.white)
  112.     term.clear()
  113.     term.setCursorPos(1,1)
  114. end
  115.  
  116. -- Body
  117.  
  118. connexion()
  119. initMenu()
  120. initLigne()
  121. command()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement