xXm0dzXx

Untitled

Jul 11th, 2012
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. print("Path to server folder:")
  2. input = read()
  3. if not fs.exists(input.. "/server.txt") then
  4. print("Unknown file path or specified path is not a server.")
  5. return
  6. end
  7.  
  8. function menu()
  9. local tLines = {}
  10. local file = io.open(input.. "/server.properties, "r")
  11. local line
  12. while true do
  13. line = file:read()
  14. if not line then break end
  15. tLines[#tLines+1] = line
  16. end
  17. file:close()
  18. shell.run("clear")
  19. print("MOTD: " ..string.sub(tLines[24], 6, string.len(tLines[24])).. "\nWorld: " ..string.sub(tLines[4], 12, string.len(tLines[4])).. "\n")
  20.  
  21. print("Options:")
  22. if fs.exists(input.. "/plugins/CCServer") then
  23. print("1) Console")
  24. else
  25. print("1) Console (READ-ONLY)")
  26. end
  27.  
  28. print("2) Edit Properties")
  29.  
  30. write("/ = execute command\n Do: ")
  31. option = read()
  32.  
  33. local tWords = {}
  34. for match in string.gmatch(option, "[^ \t]+") do
  35. table.insert( tWords, match )
  36. end
  37.  
  38. local sCommand = tWords[1]
  39. if sCommand == "/op" and tWords[2] then
  40. test = fs.open(input.. "/ops.txt")
  41. test.writeLine(tWords[2])
  42. test.close()
  43.  
  44. print("Player op'd.")
  45. elseif sCommand == "/ban" then
  46. test = fs.open(input.. "/banned-players.txt")
  47. test.writeLine(tWords[2])
  48. test.close()
  49.  
  50. print("Player banned.")
  51. elseif sCommand == "/ban-ip" then
  52. test = fs.open(input.. "/banned-ips.txt")
  53. test.writeLine(tWords[2])
  54. test.close()
  55.  
  56. print("IP banned.")
  57. elseif sCommand == "/help" then
  58. print("Commands: ban, ban-ip, op")
  59. print("Install my plugin for every command and more!")
  60. elseif string.sub(sCommand, 1, 1,) == "/" then
  61. print("Unknown command. Type help for help.")
  62. end
  63.  
  64. if sCommand == "1" then
  65. local tLines = {}
  66. local file = io.open(input.. "/server.txt, "r")
  67. local line
  68. while true do
  69. line = file:read()
  70. if not line then break end
  71. print(line)
  72. end
  73. file:close()
  74.  
  75. print("\nPress any key to continue..")
  76. os.pullEvent("key")
  77. elseif sCommand == "2" then
  78. shell.run("edit", input.. "/server.properties")
  79. else
  80. print("Unknown input..")
  81. end
  82.  
  83. sleep(2)
  84. menu()
  85. end
Advertisement
Add Comment
Please, Sign In to add comment