xXm0dzXx

Untitled

Jul 11th, 2012
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. print("Path to server folder:")
  2. input = read()
  3. if not fs.exists(input.. "/server.log") 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", "w")
  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", "w")
  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 = fs.open(input.. "/server.log", "r")
  67. print(file.readAll())
  68. file:close()
  69.  
  70. print("\nPress any key to continue..")
  71. os.pullEvent("key")
  72. elseif sCommand == "2" then
  73. shell.run("edit", input.. "/server.properties")
  74. else
  75. print("Unknown input..")
  76. end
  77.  
  78. sleep(2)
  79. menu()
  80. end
  81.  
  82. menu()
Advertisement
Add Comment
Please, Sign In to add comment