View difference between Paste ID: tCqisnUd and WEyGUeDb
SHOW: | | - or go back to the newest paste.
1
local tbl = { a = "top", b = "bottom", c = "left", d = "right", f = "front", g = "back" }
2
table.foreach(tbl,
3
function(k, v)
4
 if peripheral.isPresent(v) then
5
  if peripheral.getType(v) == "modem" then
6
   print("open modem")
7
   rednet.open(v)
8-
 side="back"
8+
9-
 t=0
9+
10-
 loop=1
10+
end)
11-
 online=1
11+
shell.run("clear")
12
print("Playerlist:")
13-
 while loop > 0 do
13+
14-
  if pidx > 0 and pidx <= 1 then
14+
15-
   online=rs.testBundledInput(side, colors.white)
15+
if not fs.exists("player"..pid) then
16-
  elseif pidx > 1 and pidx <= 2 then
16+
 file=fs.open("player"..pid,"w")
17-
   online=rs.testBundledInput(side, colors.orange)
17+
 name="M3veronMast3r"
18-
  elseif pidx > 2 and pidx <= 3 then
18+
 file.writeLine(name)
19-
   online=rs.testBundledInput(side, colors.magenta)
19+
20-
  elseif pidx > 3 and pidx <= 4 then
20+
21-
   online=rs.testBundledInput(side, colors.lightBlue)
21+
22-
  elseif pidx > 4 and pidx <= 5 then
22+
 pidt=pid
23-
   online=rs.testBundledInput(side, colors.yellow)
23+
 pid=1
24-
  elseif pidx > 5 and pidx <= 6 then
24+
 while fs.exists("player"..pid) do
25-
   online=rs.testBundledInput(side, colors.lime)
25+
  pid=pid+1
26-
  elseif pidx > 6 and pidx <= 7 then
26+
27-
   online=rs.testBundledInput(side, colors.pink)
27+
 pid=pid-1
28-
  elseif pidx > 7 and pidx <= 8 then
28+
 pidz=pid
29-
   online=rs.testBundledInput(side, colors.gray)
29+
 pid=pidt
30-
  elseif pidx > 8 and pidx <= 9 then
30+
31-
   online=rs.testBundledInput(side, colors.lightGray)
31+
32-
  elseif pidx > 9 and pidx <= 10 then
32+
33-
   online=rs.testBundledInput(side, colors.cyan)
33+
 if fs.exists("players") then
34-
  elseif pidx > 10 and pidx <= 11 then
34+
  file=fs.open("players","r")
35-
   online=rs.testBundledInput(side, colors.purple)
35+
  ppidz=tonumber(file.readLine())
36-
  elseif pidx > 11 and pidx <= 12 then
36+
  if ppidz > pidz then
37-
   online=rs.testBundledInput(side, colors.blue)
37+
   pidz = ppidz
38-
  elseif pidx > 12 and pidx <= 13 then
38+
39-
   online=rs.testBundledInput(side, colors.brown)
39+
40-
  elseif pidx > 13 and pidx <= 14 then
40+
41-
   online=rs.testBundledInput(side, colors.green)
41+
42-
  elseif pidx > 14 and pidx <= 15 then
42+
 online=false
43-
   online=rs.testBundledInput(side, colors.red)
43+
 id, text = rednet.receive()
44-
  elseif pidx > 15 and pidx <= 16 then
44+
 if id == 39 then
45-
   online=rs.testBundledInput(side, colors.black)
45+
  table.foreach(text,
46-
  elseif pidx > 16 then
46+
  function(k, v)
47-
   side="bottom"
47+
   if v == name then
48-
   if pidx > 32 then
48+
    online = true
49-
    side="right"
49+
    if not fs.exists(name) then
50-
    pidx=pidx-16
50+
     file=fs.open(name,"w")
51
     Last=1
52-
   pidx=pidx-16
52+
     file.writeLine(Last)
53
     file.close()
54-
  t=t+1
54+
    end
55-
  if t > 2 then
55+
56-
   online=false
56+
   if not fs.exists(v) then
57-
   print("Bundled cable not connected")
57+
    t=1
58
    for i=1,pidz do
59-
  if online == true then
59+
     file=fs.open("player"..pidz,"r")
60-
   loop=0
60+
     if file.readLine == v then
61-
  elseif online == false then
61+
      file.close()
62-
   loop=0
62+
      file=fs.open(v,"w")
63
      Last=1
64-
   loop=1
64+
      file.writeLine(Last)
65
      file.close()
66
      t=0
67
     else
68
      file.close()
69
      if i == pidz then
70
       if t > 0 then
71
        pidt=pid
72
        pid=pidz
73
        pid=pid+1
74
        file=fs.open("player"..pid,"w")
75
        file.writeLine(v)
76
        pidz=pidz+1
77
        pid=pidt
78
        file.close()
79
        file=fs.open(v,"w")
80
        Last=1
81
        file.writeLine(Last)
82
        file.close()
83
        t=0
84
       end
85
      end
86
     end
87
    end
88
   end
89
  end)
90
 end
91
 if not online == true then
92
  online = false
93
 end
94
 if not fs.exists(name) then
95
  file=fs.open(name,"w")
96
  last=1
97
  file.writeLine(last)
98
  file.close()
99
 end
100
 if online == true then
101
  file=fs.open(name,"w")
102
  last=0
103
  file.writeLine(last)
104
  file.close()
105
 end
106
 if online == false then
107
  file=fs.open(name,"r")
108-
  term.setCursorPos( 30,pid )
108+
109
  file.close()
110
  last=last+1
111
  file=fs.open(name,"w")
112
  file.writeLine(last)
113
  file.close()
114
  seconds=last
115-
  term.setCursorPos( 30,pid )
115+
116-
  print(days.."d "..hours.."h "..minutes.."min "..seconds.."sec. ago")
116+
117
  days=0
118
  while seconds > 60 do
119
   minutes=minutes+1
120
   seconds=seconds-60
121-
pid=pid-1
121+
122
  while minutes > 60 do
123-
print("Players: "..pid)
123+
124
   minutes=minutes-60
125
  end
126
  while hours > 24 do
127
   days=days+1
128
   hours=hours-24
129
  end
130
 end
131
 if online == true then
132
  pid=pid+2
133
  term.setCursorPos( 1,pid )
134
  print(name)
135
  term.setCursorPos( 16,pid )
136
  local w,h = term.getSize()
137
  for i=16,w do
138
   write(" ")
139
  end
140
  term.setCursorPos( 20,pid )
141
  print("Online")
142
  pid=pid-2
143
 else
144
  pid=pid+2
145
  term.setCursorPos( 1,pid )
146
  print(name)
147
  term.setCursorPos( 16,pid )
148
  local w,h = term.getSize()
149
  for i=16,w do
150
   write(" ")
151
  end
152
  if w < 30 then
153
   term.setCursorPos( 16,pid )
154
   if days < 1 then
155
    print(hours.."h "..minutes.."m "..seconds.."s ago")
156
   else
157
    print(days.."d "..hours.."h "..minutes.."m")
158
   end
159
  else
160
   term.setCursorPos( 20,pid )
161
   print(days.."d "..hours.."h "..minutes.."m "..seconds.."s ago")
162
  end
163
  pid=pid-2
164
 end
165
 pid=pid+1
166
 if not fs.exists("player"..pid) then
167
  pid=1
168
  print("")
169
  print("Players: "..pidz)
170
  file=fs.open("players","w")
171
  file.writeLine(pidz)
172
  file.close()
173
  sleep(0.5)
174
 end
175
end
176
pid=pid-1