AnonymusHochgenuss

playerlist

Apr 7th, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.98 KB | None | 0 0
  1. print("Playerlist:")
  2. print("")
  3. pid=1
  4. while fs.exists("player"..pid) do
  5.  file=fs.open("player"..pid,"r")
  6.  name=file.readLine()
  7.  file.close()
  8.  side="back"
  9.  t=0
  10.  loop=1
  11.  online=1
  12.  pidx=pid
  13.  while loop > 0 do
  14.   if pidx > 0 and pidx <= 1 then
  15.    online=rs.testBundledInput(side, colors.white)
  16.   elseif pidx > 1 and pidx <= 2 then
  17.    online=rs.testBundledInput(side, colors.orange)
  18.   elseif pidx > 2 and pidx <= 3 then
  19.    online=rs.testBundledInput(side, colors.magenta)
  20.   elseif pidx > 3 and pidx <= 4 then
  21.    online=rs.testBundledInput(side, colors.lightBlue)
  22.   elseif pidx > 4 and pidx <= 5 then
  23.    online=rs.testBundledInput(side, colors.yellow)
  24.   elseif pidx > 5 and pidx <= 6 then
  25.    online=rs.testBundledInput(side, colors.lime)
  26.   elseif pidx > 6 and pidx <= 7 then
  27.    online=rs.testBundledInput(side, colors.pink)
  28.   elseif pidx > 7 and pidx <= 8 then
  29.    online=rs.testBundledInput(side, colors.gray)
  30.   elseif pidx > 8 and pidx <= 9 then
  31.    online=rs.testBundledInput(side, colors.lightGray)
  32.   elseif pidx > 9 and pidx <= 10 then
  33.    online=rs.testBundledInput(side, colors.cyan)
  34.   elseif pidx > 10 and pidx <= 11 then
  35.    online=rs.testBundledInput(side, colors.purple)
  36.   elseif pidx > 11 and pidx <= 12 then
  37.    online=rs.testBundledInput(side, colors.blue)
  38.   elseif pidx > 12 and pidx <= 13 then
  39.    online=rs.testBundledInput(side, colors.brown)
  40.   elseif pidx > 13 and pidx <= 14 then
  41.    online=rs.testBundledInput(side, colors.green)
  42.   elseif pidx > 14 and pidx <= 15 then
  43.    online=rs.testBundledInput(side, colors.red)
  44.   elseif pidx > 15 and pidx <= 16 then
  45.    online=rs.testBundledInput(side, colors.black)
  46.   elseif pidx > 16 then
  47.    side="bottom"
  48.    if pidx > 32 then
  49.     side="right"
  50.     pidx=pidx-16
  51.    end
  52.    pidx=pidx-16
  53.   end
  54.   t=t+1
  55.   if t > 2 then
  56.    online=false
  57.    print("Bundled cable not connected")
  58.   end
  59.   if online == true then
  60.    loop=0
  61.   elseif online == false then
  62.    loop=0
  63.   else
  64.    loop=1
  65.   end
  66.  end
  67.  if not fs.exists(name) then
  68.   file=fs.open(name,"w")
  69.   last=1
  70.   file.writeLine(last)
  71.   file.close()
  72.  end
  73.  if online == true then
  74.   file=fs.open(name,"w")
  75.   last=0
  76.   file.writeLine(last)
  77.   file.close()
  78.  end
  79.  if online == false then
  80.   file=fs.open(name,"r")
  81.   last=file.readLine()
  82.   file.close()
  83.   last=last+1
  84.   file=fs.open(name,"w")
  85.   file.writeLine(last)
  86.   file.close()
  87.   seconds=last
  88.   minutes=0
  89.   hours=0
  90.   days=0
  91.   while seconds > 60 do
  92.    minutes=minutes+1
  93.    seconds=seconds-60
  94.   end
  95.   while minutes > 60 do
  96.    hours=hours+1
  97.    minutes=minutes-60
  98.   end
  99.   while hours > 24 do
  100.    days=days+1
  101.    hours=hours-24
  102.   end
  103.  end
  104.  if online == true then
  105.   pid=pid+2
  106.   term.setCursorPos( 1,pid )
  107.   print(name)
  108.   term.setCursorPos( 30,pid )
  109.   print("Online")
  110.   pid=pid-2
  111.  else
  112.   pid=pid+2
  113.   term.setCursorPos( 1,pid )
  114.   print(name)
  115.   term.setCursorPos( 30,pid )
  116.   print(days.."d "..hours.."h "..minutes.."min "..seconds.."sec. ago")
  117.   pid=pid-2
  118.  end
  119.  pid=pid+1
  120. end
  121. pid=pid-1
  122. print("")
  123. print("Players: "..pid)
Add Comment
Please, Sign In to add comment