SHOW:
|
|
- or go back to the newest paste.
1 | --The serverID value is the ID of the verification | |
2 | --server. | |
3 | serverID = 1 | |
4 | --Change back to needed side | |
5 | rednet.open("back") | |
6 | ||
7 | --Graphics functions, just ignore these | |
8 | maxx,maxy = term.getSize() | |
9 | ||
10 | local function drawLine(y) | |
11 | local num = 1 | |
12 | term.setCursorPos(1,y) | |
13 | repeat | |
14 | term.setBackgroundColor(colours.black) | |
15 | term.write(" ") | |
16 | num = num + 1 | |
17 | until num == maxx+1 | |
18 | term.setCursorPos(maxx,1) | |
19 | end | |
20 | ||
21 | local function split(y) | |
22 | term.setBackgroundColor(colours.white) | |
23 | term.setCursorPos(math.floor(maxx/2-1),y) | |
24 | term.write(" ") | |
25 | term.setBackgroundColor(colours.black) | |
26 | end | |
27 | ||
28 | ||
29 | function createOption(number, text1, text2) | |
30 | if number == 1 then | |
31 | start = 3 | |
32 | elseif number == 2 then | |
33 | start = 8 | |
34 | elseif number == 3 then | |
35 | start = 13 | |
36 | end | |
37 | drawLine(start) | |
38 | drawLine(start+1) | |
39 | drawLine(start+2) | |
40 | split(start) | |
41 | split(start+1) | |
42 | split(start+2) | |
43 | term.setCursorPos(2,start+1) | |
44 | if number == 1 then | |
45 | print("1) "..text1) | |
46 | elseif number == 2 then | |
47 | print("3) "..text1) | |
48 | elseif number == 3 then | |
49 | print("5) "..text1) | |
50 | end | |
51 | term.setCursorPos(maxx/2+3,start+1) | |
52 | if number == 1 then | |
53 | print("2) "..text2) | |
54 | elseif number == 2 then | |
55 | print("4) "..text2) | |
56 | elseif number == 3 then | |
57 | print("6) "..text2) | |
58 | end | |
59 | end | |
60 | ||
61 | ||
62 | function verifyUser(user,pass) | |
63 | rednet.send(serverID,"verificationServer?") | |
64 | repeat | |
65 | id,msg = rednet.receive(10) | |
66 | until id == serverID | |
67 | if id == serverID and msg == "verificationServer!" then | |
68 | rednet.send(serverID,textutils.serialize({user,pass})) | |
69 | repeat | |
70 | id,msg = rednet.receive(10) | |
71 | until id == serverID and msg == "verified!" or msg == "verified~" | |
72 | if msg == "verified!" then | |
73 | return true | |
74 | else | |
75 | return false | |
76 | end | |
77 | end | |
78 | end |