Hi there i have a long code to protect a area with a password.
the only problem is that the soft termination is off but the hard termination using control alt c is bypassing my door protection
and terminating my program so they can hack in my door
how can i prevent that from happening?
here is my code:
local component=require("component")
local event = require("event")
local r=component.redstone
local gpu=component.gpu
local term=require("term")
local password="21013"
local password2="mmuziek21013"
local delay=5
local c = require("computer")
local side=4
local wrong=false
event.shouldInterrupt(false)
while true do
term.clear()
gpu.set(1,1,"please enter ADMIN CODE")
if wrong then
gpu.set(1,1,"Wrong admin code given!")
wrong=false
end
term.setCursor(1,2)
local input=io.read()
if input==password then
r.setOutput(side,15)
os.sleep(delay)
r.setOutput(side,0)
elseif input==password2 then
gpu.set(1,2,"Root access granted")
os.exit()
else
wrong=true
end
if event.onError(interrupted) then
c.shutdown(true)
end
end
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Hi there i have a long code to protect a area with a password.
the only problem is that the soft termination is off but the hard termination using control alt c is bypassing my door protection
and terminating my program so they can hack in my door
how can i prevent that from happening?
here is my code:
local component=require("component") local event = require("event") local r=component.redstone local gpu=component.gpu local term=require("term") local password="21013" local password2="mmuziek21013" local delay=5 local c = require("computer") local side=4 local wrong=false event.shouldInterrupt(false) while true do term.clear() gpu.set(1,1,"please enter ADMIN CODE") if wrong then gpu.set(1,1,"Wrong admin code given!") wrong=false end term.setCursor(1,2) local input=io.read() if input==password then r.setOutput(side,15) os.sleep(delay) r.setOutput(side,0) elseif input==password2 then gpu.set(1,2,"Root access granted") os.exit() else wrong=true end if event.onError(interrupted) then c.shutdown(true) end end