Guest User

Untitled

a guest
Mar 23rd, 2013
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. local nPullevent = os.pullEvent -- So you cant terminate the program
  2. os.pullEvent = os.pullEventRaw
  3.  
  4. while true do
  5.     term.clear()
  6.     term.setCursorPos( 1,1 )
  7.  
  8.     print( "Keltecfanboy Security System V2.0" )
  9.     print( "Right click on the ..." )
  10.  
  11.     rednet.open( "back" )
  12.  
  13.     local file = fs.open( "ulist", "r" )
  14.     local reader = file.readAll()
  15.     file.close() -- you ALWAYS should do that.
  16.  
  17.     local players = textutils.unserialize( reader ) -- You have to serialize before you write to a file
  18.  
  19.     local evt, player = os.pullEvent( "player" )
  20.     local succes = false
  21.     for i = 1, #players do
  22.         if player == players[i] then
  23.             rs.setOutput( "bottom", true )
  24.             sleep( 8 )
  25.             rs.setOutput( "bottom", false )
  26.             succes = true
  27.             break
  28.         end
  29.     end
  30.  
  31.     if not succes then
  32.         print( "Unauthorized user!" )
  33.         rednet.send( 2, "attack" ) -- we can send only strings OR variables wich are strings
  34.     else
  35.         break
  36.     end
  37. end
  38.  
  39. os.pullEvent = nPullevent
Advertisement
Add Comment
Please, Sign In to add comment