kremnev8

Untitled

Feb 4th, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. m = peripheral.wrap("back")
  2. m.open(51)
  3. local function pulse(side)
  4. rs.setOutput(side, true)
  5. sleep(3)
  6. rs.setOutput(side,false)
  7. end
  8. Tr = true
  9. function os.pullEvent()
  10. local event, p1,p2,p3,p4,p5 = os.pullEventRaw()
  11. if event == "terminate" then write("For terminate need password:")
  12. p = read()
  13. if p == "ex" then
  14. Tr = false
  15. print("exiting")
  16. end
  17. end
  18. return event,p1,p2,p3,p4,p5
  19. end
  20.  
  21. function Add(Name)
  22. Fold = "Assets/"
  23. RC = Fold .. Name
  24. fs.makeDir("Assets")
  25. Name = tostring(Name)
  26. if fs.exists(Name) then
  27. return false
  28. else
  29. f = fs.open(Name,"w")
  30. f.close()
  31. return true
  32. end
  33. end
  34.  
  35. function Rm(Name)
  36. inp = "Assets/" .. Name
  37. if fs.exists(inp) then
  38. fs.delete(inp)
  39. return true
  40. else
  41. return false
  42. end
  43. end
  44.  
  45. while Tr do
  46. Recive = {"","",""}
  47. Recive[1],Recive[2],Recive[3],Recive[4],Recive[5] = os.pullEvent()
  48. for i=1,#Recive do
  49. print(Recive[i])
  50.  
  51. end
  52. pL = fs.list("Assets")
  53.  
  54. if Recive[1] == "player" or "modem_message" then
  55.  
  56. if Recive[1] == "modem_message" then
  57.  
  58. for k,v in string.gmatch(Recive[5], "(%w+)=(%w+)") do
  59. if k == "rOpen" then
  60. pulse("right")
  61. elseif k == "add" then
  62. Add(v)
  63. elseif k == "rm" then
  64. Rm(v)
  65. end
  66. end
  67.  
  68. elseif Recive[1] == "player" then
  69. for i =1 , 10 ,1 do
  70.  
  71. if Recive[3] == pL[i] then
  72. pulse("right")
  73. end
  74. end
  75. end
  76. end
  77. end
Advertisement
Add Comment
Please, Sign In to add comment