Cavious

shield_client

Jun 25th, 2014
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. rednet.open("back")
  2. server_id = 58
  3.  
  4. state = true
  5.  
  6. function run()
  7.  
  8.     term.setBackgroundColor(colors.gray)
  9.     term.clear()
  10.     term.setTextColor(colors.yellow)
  11.     term.setCursorPos(1,1)
  12.     term.write("Shield Client v1.0")
  13.     term.setCursorPos(1,2)
  14.     term.write("==================")
  15.  
  16.     while(state) do
  17.    
  18.         term.setTextColor(colors.yellow)
  19.         term.setCursorPos(1,4)
  20.         term.write("#<<Enter Password>>#")
  21.         term.setCursorPos(1,5)
  22.         term.setTextColor(colors.lightBlue)
  23.         local password = read("*")
  24.        
  25.         term.setCursorPos(1,5)
  26.         term.clearLine()
  27.         term.setCursorPos(1,4)
  28.         term.setTextColor(colors.yellow)
  29.         term.write("#<<Enter Function(ON/OFF)>>#")
  30.         term.setCursorPos(1,5)
  31.         term.setTextColor(colors.lightBlue)
  32.         local request = read()
  33.        
  34.         term.clearLine()
  35.         term.setCursorPos(1,4)
  36.         term.clearLine()
  37.         term.setTextColor(colors.yellow)
  38.         term.write("Waiting on server for verification...")
  39.         os.sleep(1)
  40.        
  41.         local packet = "<p>"..password.."</p>".."<r>"..request:lower().."</r>"
  42.         rednet.send(server_id, packet)
  43.        
  44.         local id, message, protocol = rednet.receive()
  45.        
  46.         term.setCursorPos(1,4)
  47.         term.clearLine()
  48.         term.write(message)
  49.         os.sleep(1)
  50.         term.clearLine()
  51.        
  52.         state = false
  53.    
  54.     end
  55.    
  56.            
  57.         os.sleep(1)
  58.         term.clear()
  59. end
  60.  
  61. run()
Advertisement
Add Comment
Please, Sign In to add comment