owodaddy

Untitled

Dec 5th, 2021 (edited)
688
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","Cancle"}
  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.     local kppin = ""
  24.     repeat
  25.         eventName, address, button, button_label = event.pull("keypad")
  26.         print("key pressed: " .. button)
  27.         if button == "Cancle" then
  28.             break
  29.         end
  30.         kppin = kppin .. button
  31.         keypad.setDisplay(kppin, 1)
  32.     until #kppin == 8
  33.     if button == "Cancle" then
  34.         return
  35.     end
  36.     suc = datacard:decrypt(cardData,"&F)J@NcRfTjWnZr4",kppin..kppin)
  37.     if suc == playername then
  38.         keypad.setDisplay("ACCESS GRANTED", 1)
  39.     else
  40.         keypad.setDisplay("ACCESS DENIED TRY AGAIN", 1)
  41.         os.sleep(2.5)
  42.         OnRead(_,_,playername,cardData,UUID,isLocked,_)
  43.     end
  44. end
  45.  
  46. event.listen("magCardRead", OnRead)
  47. event.pull("interrupted")
  48. --event.ignore("magCardRead", OnRead)
RAW Paste Data