kizz12

guest

Apr 21st, 2015
830
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | None | 0 0
  1. --local osEvent=os.pullEvent
  2. --os.pullEvent=os.pullEventRaw
  3.  
  4. function protect()
  5.     local combine = fs.combine
  6.     local oldFs = fs.open
  7.     --print'OS Protect active!'
  8.     fs.open = function(path,...)
  9.         if combine("/",path) == "rom/programs/edit" then
  10.             --print'Failed to call edit!'
  11.             return
  12.         end
  13.         if combine("/",path) == "rom/programs/delete" then
  14.             --print'Failed to call delete!'
  15.             return
  16.         end
  17.         if combine("/",path) ~= "rom/programs/delete" then
  18.             return oldFs(path,...)
  19.         end
  20.     end
  21. end
  22.  
  23.  
  24. function logout()
  25.     timetor=300
  26.     while timetor > 0 do
  27.         term.clear()
  28.         term.setCursorPos(1,1)
  29.         timetor=timetor-1
  30.         print('Welcome Guest. System Online. Restarting in '..timetor..' seconds.')
  31.         print('System set to restrictive access due to security level.')
  32.         sleep(.95)
  33.     end
  34.     os.reboot()
  35. end
  36.  
  37. function listener()
  38.     while true do      
  39.         eventExtend,timer = os.pullEvent("extendme")
  40.         if eventExtend == "extendme" and timer > 0 then
  41.             print("Extending time!")
  42.             timetor=timetor+timer
  43.         end
  44.     end
  45. end
  46.  
  47.  
  48.  
  49. parallel.waitForAll(listener,logout,protect)
  50. os.pullEvent=osEvent
Advertisement
Add Comment
Please, Sign In to add comment