I would do it this way:
adding a use script to the keypad which can be used 3 times. here is a picture of it:
and here the code of the script:
if (not HasAttribute(game, "keypadused")) {
game.keypadused = 0
}
PrintCentered ("PLEASE ENTER SECURITY CODE")
get input {
if (result="4863") {
UnlockExit (office exit)
PrintCentered ("PASSWORD ACCEPTED, ACCESS GRANTED,")
PrintCentered ("OFFICE DOOR UNLOCKED")
}
else {
game.keypadused = game.keypadused+1
if (3>game.keypadused) {
PrintCentered ("ACCESS DENIED")
PrintCentered ("You notice a strange sound, like a machine being powered on.")
}
else {
PrintCentered ("ACCESS DENIED. BEEEEEEEEP. ACCESS DENIED. BEEEEEEEEP. ACCESS DENIED. BEEEEEEEEP. ACCESS DENIED. BEEEEEEEEP")
PrintCentered ("An alarm sounds. The machine gun starts up. There is no way you can escape in time.")
PrintCentered ("YOU ARE NOW DEAD")
finish
}
}
}