Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function init()
- while true do
- rs.setOutput('back', rs.getInput('top'))
- if ( not rs.getInput('top') ) then
- local headers = {
- ['User-Agent'] = 'Mozilla/5.0 (Linux; Android 7.0; SM-G892A Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/60.0.3112.107 Mobile Safari/537.36'
- }
- local response = http.get('http://mcapi.xdefcon.com/server/ie.toastynetworks.net/players/text', headers)
- local currentPlayers = response.readAll()
- local responseCode = response.getResponseCode()
- if ( tonumber(currentPlayers) == 0 ) then
- rs.setOutput('back', true)
- else
- rs.setOutput('back', false)
- end
- response.close()
- end
- sleep(5)
- end
- end
- function safeString(text)
- local newText = {}
- for i = 1, #text do
- local val = text:byte(i)
- newText[i] = (val > 31 and val < 127) and val or 63
- end
- return string.char(unpack(newText))
- end
- init()
Advertisement
Add Comment
Please, Sign In to add comment