Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local a=http.get"https://raw.githubusercontent.com/rxi/json.lua/bee7ee3431133009a97257bde73da8a34e53c15c/json.lua"local b=fs.open("json","w")b.write(a.readAll())a.close()b.close()
- local json = require "/json"
- API = "https://dynmap.switchcraft.pw/up/world/world/"
- local function fetch(url, headers)
- local h = http.get(url, headers)
- local o = h.readAll()
- h.close()
- return o
- end
- local m = peripheral.find "modem"
- while true do
- local data = json.decode(fetch(API .. os.epoch "utc", {
- Cookie = "JSESSIONID=abcd",
- }))
- local tosend = {}
- for _, player in pairs(data.players) do
- if player.world == "DIM1_the_end" then
- table.insert(tosend, { player.name, player.x, player.y, player.z })
- end
- end
- print("Broadcasting locations of", #tosend, "players")
- m.transmit(1103, 1103, tosend)
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement