Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local discordhook = require("/DiscordHook")
- require("/stringtools")()
- local modem = peripheral.find("modem")
- local channel = 48548
- local response_channel = 49549
- local all_chars = {}
- local id = os.getComputerID()
- local success, hook = discordhook.createWebhook("https://discord.com/api/webhooks/1304995457105399808/WuYXIA8H9rhUDmAboWM105j2dBkmYM5c8vphwAv3vndy01NKE3h8cqf2M34rsKH_L6gb")
- for i = 0, 255 do
- all_chars[i + 1] = string.char(i)
- end
- modem.open(response_channel)
- local function encrypt(message)
- message = string.fracture(message)
- local new = ""
- for _, char in pairs(message) do
- for _idx, _char in ipairs(all_chars) do
- if char == _char then
- new = new..all_chars[(_idx+id)%#all_chars]
- end
- end
- end
- return new.."_"..id
- end
- local function decrypt(message)
- message = string.fracture(message)
- local unlock_id = ""
- for i = #message, 1, -1 do
- if message[i] ~= "_" then
- unlock_id = unlock_id..message[i]
- else
- for j = i, #message do
- message[j] = nil
- end
- break
- end
- end
- unlock_id = tonumber(string.reverse(unlock_id))
- local new = ""
- for _, char in pairs(message) do
- for _idx, _char in ipairs(all_chars) do
- if char == _char then
- new = new..all_chars[(_idx-unlock_id)%#all_chars]
- end
- end
- end
- return new
- end
- local function timer()
- local time = 1
- repeat
- os.sleep(1)
- time = time + 1
- until time == 5
- end
- local passive = false
- repeat
- local time = os.time(os.date("!*t"))
- modem.transmit(channel, response_channel, encrypt("REQUESTING CHECK"))
- local message, distance = nil, nil
- parallel.waitForAny(timer, function() _, _, _, _, message, distance = os.pullEvent("modem_message") end)
- if decrypt(message and message or "") == "SAFE" and distance/16 <= 24 then
- passive = true
- else
- hook.send(id..": NON-PLAYER IN AREA FOUND AT <t:"..time..":D> <t:"..time..":T>")
- end
- until passive
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement