Advertisement
DOGGYWOOF

Overide Power Keys

Oct 7th, 2024 (edited)
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. -- BlockShutdown.lua
  2.  
  3. -- Function to block specific keys
  4. local function blockKeys()
  5. print("Blocking shutdown and reboot keys. Press Ctrl+C to stop the program.")
  6.  
  7. while true do
  8. local event, key = os.pullEvent("key")
  9.  
  10. -- Check if the key pressed is 'shutdown' (key code 24) or 'reboot' (key code 30)
  11. if key == keys.shutdown or key == keys.reboot then
  12. print("Shutdown or Reboot key pressed. Action blocked!")
  13. else
  14. print("Key pressed: " .. keys.getName(key))
  15. end
  16. end
  17. end
  18.  
  19. -- Start blocking keys
  20. blockKeys()
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement