Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --variables
- local loadPath = "locker/locked"
- local prog = shell.getRunningProgram()
- local locked = {"startup"}
- local pass = "test"
- -- restore functions
- local fsOpen = fs.open
- local fsDelte = fs.delete
- table.insert(locked, prog)
- -- functions
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function cPrint(str)
- w,h = term.getSize()
- local x,y = term.getCursorPos()
- term.setCursorPos(math.ceil((w+1)/2 - #str/2), y)
- print(str)
- end
- function password(file)
- print("You Can Enter A Password To Undo This")
- write("Enter Password: ")
- if pass == read() then
- -- remove program from locked
- for k, v in pairs(locked) do
- if v == file then
- table.remove(locked, k)
- end
- end
- print("Program Unlocked!")
- lock()
- end
- end
- function load() -- continue later
- end
- function lock()
- -- open
- fs.open = function(file, mode)
- for _, v in pairs(locked) do
- if file == v then
- clear()
- cPrint("This Program Has Been Locked\nYou Cannot Open It!")
- password(v)
- return false
- end
- end
- return fsOpen(file,mode)
- end
- -- delete
- fs.delete = function(file)
- for _, v in pairs(locked) do
- if file == v then
- clear()
- cPrint("This Program Has Been Locked \nYou Cannot Delete It!")
- password()
- return false
- end
- end
- return fsDelete(file)
- end
- end
- lock()
Advertisement
Add Comment
Please, Sign In to add comment