Advertisement
AssortedBrunoz

mainpc

Nov 24th, 2024 (edited)
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.13 KB | None | 0 0
  1. local discordhook = require("/DiscordHook")
  2. require("/stringtools")()
  3. local modem = peripheral.find("modem")
  4. local channel = 48548
  5. local response_channel = 49549
  6. local all_chars = {}
  7. local id = os.getComputerID()
  8.  
  9. local success, hook = discordhook.createWebhook("https://discord.com/api/webhooks/1304995457105399808/WuYXIA8H9rhUDmAboWM105j2dBkmYM5c8vphwAv3vndy01NKE3h8cqf2M34rsKH_L6gb")
  10.  
  11.  
  12. for i = 0, 255 do
  13.     all_chars[i + 1] = string.char(i)
  14. end
  15.  
  16. modem.open(response_channel)
  17.  
  18.  
  19. local function encrypt(message)
  20.     message = string.fracture(message)
  21.     local new = ""
  22.     for _, char in pairs(message) do
  23.         for _idx, _char in ipairs(all_chars) do
  24.             if char == _char then
  25.                 new = new..all_chars[(_idx+id)%#all_chars]
  26.             end
  27.         end
  28.     end
  29.     return new.."_"..id
  30. end
  31.  
  32. local function decrypt(message)
  33.     message = string.fracture(message)
  34.     local unlock_id = ""
  35.     for i = #message, 1, -1 do
  36.         if message[i] ~= "_" then
  37.             unlock_id = unlock_id..message[i]
  38.         else
  39.             for j = i, #message do
  40.                 message[j] = nil
  41.             end
  42.             break
  43.         end
  44.     end
  45.     unlock_id = tonumber(string.reverse(unlock_id))
  46.     local new = ""
  47.     for _, char in pairs(message) do
  48.         for _idx, _char in ipairs(all_chars) do
  49.             if char == _char then
  50.                 new = new..all_chars[(_idx-unlock_id)%#all_chars]
  51.             end
  52.         end
  53.     end
  54.     return new
  55. end
  56.  
  57. local function timer()
  58.     local time = 1
  59.     repeat
  60.         os.sleep(1)
  61.         time = time + 1
  62.     until time == 5
  63. end
  64.  
  65. local passive = false
  66. repeat
  67.     local time = os.time(os.date("!*t"))
  68.     modem.transmit(channel, response_channel, encrypt("REQUESTING CHECK"))
  69.     local message, distance = nil, nil
  70.  
  71.     parallel.waitForAny(timer, function() _, _, _, _, message, distance = os.pullEvent("modem_message") end)
  72.  
  73.     if decrypt(message and message or "") == "SAFE" and distance/16 <= 24 then
  74.         passive = true
  75.     else
  76.         hook.send(id..": NON-PLAYER IN AREA FOUND AT <t:"..time..":D> <t:"..time..":T>")
  77.     end
  78.  
  79. until passive
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement