owodaddy

Untitled

Dec 5th, 2021 (edited)
435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. component = require("component")
  2.  
  3. event = require("event")
  4. keypad = component.os_keypad
  5. datacard = component.data
  6. cardreader = component.os_magreader
  7.  
  8. keypad.setEventName("keypad")
  9. keypad.setDisplay("Enter PIN", 1)
  10.    
  11. keypad.setVolume(0.25);
  12. keypad.getVolume();
  13.  
  14. customButtons = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0","11"}
  15. customButtonColor = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
  16.  
  17. keypad.setKey(customButtons, customButtonColor)
  18.  
  19. local _eventName = "magCardRead"
  20. cardreader.setEventName(_eventName)
  21.  
  22. function OnRead(_,_,playername,cardData,UUID,isLocked,_)
  23.  kppin = ""
  24.   repeat
  25. eventName, address, button, button_label = event.pull("keypad")
  26.  print(kppin .. " len:" .. #kppin)
  27.  kppin = kppin +  button
  28.  keypad.setDisplay(kppin, 1)
  29.  until #kppin > 7
  30.  suc = datacard:decrypt(cardData,"&F)J@NcRfTjWnZr4",kppin..kppin)
  31.  if suc == playername then
  32.   print("ACCESS GRANTED", 1)
  33.  else
  34.   print("ACCESS DENIED TRY AGAIN", 1)
  35.   os.sleep(2.5)
  36.   OnRead(_,_,playername,cardData,UUID,isLocked,_)
  37.  end
  38. end
  39.  
  40. event.listen("magCardRead", OnRead)
  41. event.pull("interrupted")
  42. event.ignore("magCardRead", OnRead)
Add Comment
Please, Sign In to add comment