Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- This scripts saves current playercount to a file ever 20 seconds. Must be a commandblock computer and chunkloaded.
- -- Made this to cirumvent the Rcon playerlist & /testfor bug returning 0 players at all times on MC 1.7.10, reading the file on the webserver
- local function SaveFile(data)
- local file = fs.open("playerCount","w")
- sleep(0.1)
- file.write(textutils.serialize(data))
- sleep(0.1)
- file.close()
- end
- while true do
- ok, result = commands.xp( "0 @a[r=" .. tostring( nLimit ) .. "]" )
- local int=0
- for k,v in pairs(result) do
- int=int+1
- end
- SaveFile(int)
- term.clear()
- term.setCursorPos(1,1)
- print("There are currently "..int.." player(s) online")
- sleep(20)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement