Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local inet = require("internet")
- --make a request to the API server
- local req = inet.request("https://api.mcsrvstat.us/1/TheGeekShackATM3Remix.nn.pe")
- --some variables to fill, we really only need testout and resp
- local resp = ""
- local newtest = 0
- --for each line in request response. append to a text line
- for line in req do
- resp = resp .. line .. "\n"
- end
- --get a substring, from response, starting at where online occurs +7, and finishing 2 characters later
- --testout = string.sub(resp,string.find(resp,"online")+7,string.find(resp,"online")+9)
- newtest = string.match(resp,"online..(%d)")
- --this is the full text.. spammy
- --print(resp)
- --print("online count" .. testout)
- print("Online Count: " .. newtest)
- --convert to number
- newtest = tonumber(newtest)
- --test logic for machine on/off
- if newtest <= 3 then
- print("not many players on, LAG THE FUCKERS!")
- else
- print("better be nice")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement