Advertisement
DOGGYWOOF

blocked

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