Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- scanner = peripheral.wrap("top")
- timeInterval = 1
- logOutputFile = "playerLog"
- newLogTitle = "Neuer Log startet."
- monitor = peripheral.wrap("right")
- monitor.setCursorPos(1,1)
- monitor.clear()
- monitor.setTextColor(32)
- time = {m = -timeInterval, h = 0, d = 0}
- while true do
- players = scanner.getPlayers()
- time.m = time.m + timeInterval
- monitor.clear()
- monitor.setCursorPos(1,1)
- monitor.write("Spieler Online:")
- for i=1,#players do
- monitor.setCursorPos(1,i+2)
- monitor.write(players[i].name)
- end
- if time.m >= 60 then
- time.m = time.m - 60
- time.h = time.h + 1
- if players[1] == nil then logger("Niemand ist hier", false)
- end
- end
- if time.h >= 24 then time.h = time.h - 24 time.d = time.d + 1
- end
- function logger(input, title)
- logFile = fs.open(logOutputFile,"a")
- log = input
- if title == false then
- log = "[" .. tostring(time.m) .. "/" .. tostring(time.h) .. "/" .. tostring(time.d) .. "] " .. input
- end
- print(log)
- logFile.writeLine(log)
- logFile.close()
- end
- if time.m == 0 and time.h == 0 and time.d == 0 then logger("\n" .. newLogTitle, true)
- end
- for i=1,#players do
- for key,value in pairs(players[i]) do
- if key == "name" and value ~= nil and value ~= "Valerius2101" then
- logger(value, false)
- end
- end
- end
- sleep(timeInterval * 5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement