Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Path to server folder:")
- input = read()
- if not fs.exists(input.. "/server.log") then
- print("Unknown file path or specified path is not a server.")
- return
- end
- function menu()
- local tLines = {}
- local file = io.open(input.. "/server.properties", "r")
- local line
- while true do
- line = file:read()
- if not line then break end
- tLines[#tLines+1] = line
- end
- file:close()
- shell.run("clear")
- print("MOTD: " ..string.sub(tLines[24], 6, string.len(tLines[24])).. "\nWorld: " ..string.sub(tLines[4], 12, string.len(tLines[4])).. "\n")
- print("Options:")
- if fs.exists(input.. "/plugins/CCServer") then
- print("1) Console")
- else
- print("1) Console (READ-ONLY)")
- end
- print("2) Edit Properties")
- write("/ = execute command\n Do: ")
- option = read()
- local tWords = {}
- for match in string.gmatch(option, "[^ \t]+") do
- table.insert( tWords, match )
- end
- local sCommand = tWords[1]
- if sCommand == "/op" and tWords[2] then
- test = fs.open(input.. "/ops.txt")
- test.writeLine(tWords[2])
- test.close()
- print("Player op'd.")
- elseif sCommand == "/ban" then
- test = fs.open(input.. "/banned-players.txt", "w")
- test.writeLine(tWords[2])
- test.close()
- print("Player banned.")
- elseif sCommand == "/ban-ip" then
- test = fs.open(input.. "/banned-ips.txt", "w")
- test.writeLine(tWords[2])
- test.close()
- print("IP banned.")
- elseif sCommand == "/help" then
- print("Commands: ban, ban-ip, op")
- print("Install my plugin for every command and more!")
- elseif string.sub(sCommand, 1, 1) == "/" then
- print("Unknown command. Type help for help.")
- end
- if sCommand == "1" then
- local tLines = {}
- local file = fs.open(input.. "/server.log", "r")
- print(file.readAll())
- file:close()
- print("\nPress any key to continue..")
- os.pullEvent("key")
- elseif sCommand == "2" then
- shell.run("edit", input.. "/server.properties")
- else
- print("Unknown input..")
- end
- sleep(2)
- menu()
- end
- menu()
Advertisement
Add Comment
Please, Sign In to add comment