cobra_tomtrein

Server

Nov 2nd, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. rednet.open("top")
  2. while true do
  3. local senderId, message, protocol = rednet.receive()
  4. if protocol == "rpage" then
  5. if fs.exists(message..".web") then
  6. print("found")
  7. file = fs.open(message..".web", "r")
  8. page = file.readAll()
  9. file.close()
  10. rednet.send(senderId, page)
  11. else
  12. print("not found")
  13. rednet.send(senderId, "false")
  14. end
  15. end
  16. if protocol == "rimage" then
  17. if fs.exists(message..".img") then
  18. print("found")
  19. file = fs.open(message..".img", "r")
  20. page = file.readAll()
  21. file.close()
  22. rednet.send(senderId, page)
  23. else
  24. print("not found")
  25. rednet.send(senderId, "false")
  26. end
  27. end
  28. if protocol == "rprgm" then
  29. if fs.exists(message..".prgm") then
  30. print("found")
  31. file = fs.open(message..".prgm", "r")
  32. page = file.readAll()
  33. file.close()
  34. rednet.send(senderId, page)
  35. else
  36. print("not found")
  37. rednet.send(senderId, "false")
  38. end
  39. end
  40. if protocol == "runss" then
  41. if fs.exists(message..".ssprgm") then
  42. print("found")
  43. rednet.send(senderId, "sender")
  44. shell.run(message..".ssprgm")
  45. else
  46. print("not found")
  47. rednet.send(senderId, "false")
  48. end
  49. end
  50. end
Advertisement
Add Comment
Please, Sign In to add comment