jaklsfjlsak

自毁 相

Sep 5th, 2022 (edited)
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.77 KB | None | 0 0
  1. local discordUri = ""
  2. local name = ""
  3. local allowed = {"InfiniteBlock", "Quantumly"}
  4. function isWhitelisted(name)
  5.  
  6. for i = 1, #allowed do
  7. if name == allowed[i] then
  8. return true
  9. end
  10. end
  11. return false
  12. end
  13. local function tick()
  14. local cameras = {}
  15. local camera
  16. local sides = peripheral.getNames()
  17.  
  18. for _,side in pairs(sides) do
  19.   if peripheral.getType(side) == "warpdriveCamera" then
  20.     print("Camera found on " .. side)
  21.     table.insert(cameras, peripheral.wrap(side))
  22.   end
  23.  end
  24.  
  25. while true do
  26.  for _, camera in pairs(cameras) do
  27.   local delay = 0
  28.   local count
  29.   local oldText = ""
  30.   repeat
  31.     count = camera.getResultsCount()
  32.     os.sleep(0.1)
  33.     delay = delay + 1
  34.   until (count ~= nil and count ~= -1) or delay > 10
  35.  
  36.   if count ~= nil and count > 0 then
  37.     for i=0, count-1 do
  38.       success, type, name, x, y, z, vx, vy, vz = camera.getResult(i)
  39.       x = math.floor(x * 10) / 10
  40.       y = math.floor(y * 10) / 10
  41.       z = math.floor(z * 10) / 10
  42.       if success then
  43.         if type == "minecraft:player" and not isWhitelisted(name) then
  44.           player = "".. name .." @ (" .. x .. " " .. y .. " " .. z .. ")"
  45.           if fs.exists(name) then
  46.             local f = fs.open(name,"r")
  47.             oldText = f.readAll()
  48.             f.close()
  49.           end
  50.           if string.match(oldText, x) and string.match(oldText, z) then
  51.             print(name.." No Movement.")
  52.  
  53.           else
  54.             local f2 = fs.open(name,"w")
  55.             local epoch = math.floor(os.epoch("utc") / 1000) + (3600 * tonumber("13"))
  56.             local t = os.date("!*t",epoch)
  57.             f2.write("".. name .." @ " .. x .. " " .. y .. " " .. z .. " Date: " ..t.day .. "/" .. t.month .. "/" .. t.year .. " Time: " .. t.hour .. ":" .. t.min .. ":" .. t.sec)
  58.             print(name.." Detected.")
  59.             http.post(discordUri, "{\"content\":\""..name.." @ " .. x .. " " .. y .. " " .. z .. " Date: " ..t.day .. "/" .. t.month .. "/" .. t.year .. " Time: " .. t.hour .. ":" .. t.min .. ":" .. t.sec.."\"}",{['content-type']="application/json"})
  60.             f2.close()
  61.           end
  62.           sleep(5)
  63.         else
  64.         end
  65.       end
  66.     end
  67.   end
  68. end
  69. end
  70. end
  71. local function wait_for_q()
  72. os.pullEvent("peripheral_detach") fs.delete("startup")
  73. if name == "" then
  74. name = "unknown player"
  75. end
  76. local epoch = math.floor(os.epoch("utc") / 1000) + (3600 * tonumber("13"))
  77. local t = os.date("!*t",epoch)
  78. http.post(discordUri, "{\"content\":\""..name.." Attempted to access computer Date: " ..t.day .. "/" .. t.month .. "/" .. t.year .. " Time: " .. t.hour .. ":" .. t.min .. ":" .. t.sec.."\"}",{['content-type']="application/json"})
  79. for _, f in pairs(fs.list("/")) do
  80.  if not fs.isReadOnly(f) then
  81.     fs.delete(f)
  82.    end
  83. end
  84. end
  85. parallel.waitForAny(tick, wait_for_q)
Add Comment
Please, Sign In to add comment