View difference between Paste ID: jswPv79M and ph4LziAM
SHOW: | | - or go back to the newest paste.
1
term.clear()
2
term.setCursorPos(1,1)
3
4
local user = ""
5
6
if fs.exists("user") then
7
8
9-
while true do
9+
passf = fs.open("pass", "r")
10
userf = fs.open("user", "r")
11
12
password = passf.readLine()
13
username = userf.readLine()
14
15
passf.close()
16
userf.close()
17
18
else
19
print("please choose a username")
20
username = read()
21
ispassok = false
22
while ispassok==false do
23
term.clear()
24
term.setCursorPos(1,1)
25-
    if user=="tomtrein" and pass=="password" then
25+
print("please choose a password")
26
password = read("*")
27
print("retype password")
28
if read("*")==password then
29
  ispassok = true
30
end
31
end
32
passf = fs.open("pass", "w")
33
userf = fs.open("user", "w")
34
35
passf.writeLine(password)
36
userf.writeLine(username)
37
38
passf.close()
39
userf.close()
40
41
end
42
43
44
term.setTextColor(colors.black)
45
term.setBackgroundColor(colors.black)
46
term.clear()
47
local image = paintutils.loadImage("menupic")
48
paintutils.drawImage(image, 13, 5)
49
50
51
intrue = true
52
while intrue do
53
  local event, button, x, y = os.pullEvent( "mouse_click" )
54
  if y==8 and x>13 and x<31 then
55
    paintutils.drawLine(14,8,30,8,colors.lightBlue)
56
    term.setBackgroundColor(colors.lightBlue)
57
    term.setCursorPos(14, 8)
58
    user = read()
59
  end
60
  if y==11 and x>13 and x<31 then
61
    paintutils.drawLine(14,11,30,11,colors.lightBlue)
62
    term.setBackgroundColor(colors.lightBlue)
63
    term.setCursorPos(14, 11)
64
    pass = read("*")
65
  end
66
  if y==13 and x>13+18 and x<31+18 then
67
    term.setCursorPos(14, 13)
68
    if user==username and pass==password then
69
      term.clear()
70
      intrue = false
71
    else
72
      term.setBackgroundColor(colors.blue)
73
      term.setTextColor(colors.red)
74
      term.write("incorrect")
75
      term.setTextColor(colors.black)
76
    end
77
  end
78
end