Advertisement
DOGGYWOOF

device blocked

Jan 12th, 2024
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. local function blockKeys()
  2. local blockedKeys = {
  3. [keys.t] = true, -- Ctrl + T
  4. [keys.s] = true, -- Ctrl + S
  5. [keys.r] = true, -- Ctrl + R
  6. }
  7.  
  8. while true do
  9. local event, key = os.pullEvent("key")
  10.  
  11. -- Check if the pressed key is part of the blockedKeys table
  12. if key == keys.leftCtrl and blockedKeys[io.read(1):byte()] then
  13. -- Do nothing (block the key)
  14. else
  15. -- Allow the key to proceed
  16. os.queueEvent(event, key)
  17. end
  18. end
  19. end
  20.  
  21. local function runProgram()
  22. local unblockFile = "/path/to/unblock.lua" -- Replace with the actual path
  23.  
  24. term.clear()
  25. term.setCursorPos(1, 1)
  26. print("This device has been disabled due to suspicious activity in the system.")
  27. print("Press Enter to enable and run the program.")
  28.  
  29. local _, key = os.pullEvent("key")
  30.  
  31. if key == keys.enter then
  32. if fs.exists(unblockFile) then
  33. shell.run("/disk/os/gui")
  34. else
  35. term.clear()
  36. term.setCursorPos(1, 1)
  37. print("Error: 'unblock.lua' not found.")
  38. print("Running default program...")
  39. sleep(2)
  40. shell.run("default_program_name") -- Replace with the actual program name
  41. end
  42. end
  43. end
  44.  
  45. parallel.waitForAny(blockKeys, runProgram)
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement