Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --you will vomit looking at how bad this scripting is
- if not appendfile and readfile and writefile then warn("incompatible") else
- function gettime(format,ts)
- if ts then
- local currenttime = ""
- currenttime = os.date("*t",ts)["year"] .."/"
- currenttime = currenttime ..os.date("*t",ts)["month"] .."/"
- currenttime = currenttime ..os.date("*t",ts)["day"] .." "
- --12h time part
- if format == "24h" then
- currenttime = currenttime ..os.date("*t",ts)["hour"] ..":"
- else
- if tonumber(os.date("*t",ts)["hour"]) >12 then
- currenttime = currenttime ..tonumber(os.date("*t",ts)["hour"] - 12) ..":"
- else
- currenttime = currenttime ..os.date("*t",ts)["hour"] ..":"
- end
- end
- --adds a 0 if the time is under 10m
- if tonumber(os.date("*t",ts)["min"]) <10 then
- currenttime = currenttime ..0 ..os.date("*t",ts)["min"] ..":"
- else
- currenttime = currenttime ..os.date("*t",ts)["min"] ..":"
- end
- --adds a 0 if the time is under 10s
- if tonumber(os.date("*t",ts)["sec"]) <10 then
- currenttime = currenttime ..0 ..os.date("*t",ts)["sec"]
- else
- currenttime = currenttime ..os.date("*t",ts)["sec"]
- end
- -- adds am/pm
- if not format or format == "12h" then
- if tonumber(os.date("*t",ts)["hour"]) >11 then
- currenttime = currenttime .."PM"
- else currenttime = currenttime .."AM"
- end
- end
- return currenttime
- else
- local currenttime = ""
- currenttime = os.date("*t")["year"] .."/"
- currenttime = currenttime ..os.date("*t")["month"] .."/"
- currenttime = currenttime ..os.date("*t")["day"] .." "
- --12h time part
- if format == "24h" then
- currenttime = currenttime ..os.date("*t")["hour"] ..":"
- else
- if tonumber(os.date("*t")["hour"]) >12 then
- currenttime = currenttime ..tonumber(os.date("*t")["hour"] - 12) ..":"
- else
- currenttime = currenttime ..os.date("*t")["hour"] ..":"
- end
- end
- --adds a 0 if the time is under 10m
- if tonumber(os.date("*t",ts)["min"]) <10 then
- currenttime = currenttime ..0 ..os.date("*t",ts)["min"] ..":"
- else
- currenttime = currenttime ..os.date("*t",ts)["min"] ..":"
- end
- --adds a 0 if the time is under 10s
- if tonumber(os.date("*t")["sec"]) <10 then
- currenttime = currenttime ..0 ..os.date("*t")["sec"]
- else
- currenttime = currenttime ..os.date("*t")["sec"]
- end
- -- adds am/pm
- if not format or format == "12h" then
- if tonumber(os.date("*t")["hour"]) >11 then
- currenttime = currenttime .."PM"
- else currenttime = currenttime .."AM"
- end
- end
- return currenttime
- end
- end
- function dump()
- if appendtofile then
- pcall(function() file = readfile("DevConsoleDump.txt") end)
- if file ~= nil then
- if use24h then
- appendfile("DevConsoleDump.txt","ClientDump at "..gettime("24h") .."\n")
- else
- appendfile("DevConsoleDump.txt","ClientDump at "..gettime() .."\n")
- end
- else
- writefile("DevConsoleDump.txt","")
- wait()
- if use24h then
- appendfile("DevConsoleDump.txt","\n" .."ClientDump at "..gettime("24h") .."\n")
- else
- appendfile("DevConsoleDump.txt","\n" .."ClientDump at "..gettime() .."\n")
- end
- end
- for i,v in ipairs(game:GetService("LogService"):GetLogHistory()) do
- local table = v
- if tostring(table["messageType"]) == "Enum.MessageType.MessageOutput" and writeprints then
- if timestamps then
- if use24h then
- appendfile("DevConsoleDump.txt",tostring(gettime("24h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
- else appendfile("DevConsoleDump.txt",tostring(gettime("12h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
- end
- else appendfile("DevConsoleDump.txt",tostring(table["message"]) .."\n")
- end
- elseif tostring(table["messageType"]) == "Enum.MessageType.MessageWarning" and writewarns then
- if timestamps then
- if use24h then
- appendfile("DevConsoleDump.txt",tostring(gettime("24h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
- else appendfile("DevConsoleDump.txt",tostring(gettime("12h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
- end
- else appendfile("DevConsoleDump.txt",tostring(table["message"]) .."\n")
- end
- elseif tostring(table["messageType"]) == "Enum.MessageType.MessageError" and writeerrors then
- if timestamps then
- if use24h then
- appendfile("DevConsoleDump.txt",tostring(gettime("24h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
- else appendfile("DevConsoleDump.txt",tostring(gettime("12h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
- end
- else appendfile("DevConsoleDump.txt",tostring(table["message"]) .."\n")
- end
- end
- end
- else
- if use24h then
- filename = "Console " ..tostring(gettime("24h")):gsub(":",""):gsub("/","-") ..".txt"
- else
- filename = "Console " ..tostring(gettime()):gsub(":",""):gsub("/","-") ..".txt"
- end
- writefile(filename,"")
- for i,v in ipairs(game:GetService("LogService"):GetLogHistory()) do
- local table = v
- if tostring(table["messageType"]) == "Enum.MessageType.MessageOutput" and writeprints then
- if timestamps then
- if use24h then
- appendfile(filename,tostring(gettime("24h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
- else appendfile(filename,tostring(gettime("12h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
- end
- else appendfile(filename,tostring(table["message"]) .."\n")
- end
- elseif tostring(table["messageType"]) == "Enum.MessageType.MessageWarning" and writewarns then
- if timestamps then
- if use24h then
- appendfile(filename,tostring(gettime("24h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
- else appendfile(filename,tostring(gettime("12h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
- end
- else appendfile(filename,tostring(table["message"]) .."\n")
- end
- elseif tostring(table["messageType"]) == "Enum.MessageType.MessageError" and writeerrors then
- if timestamps then
- if use24h then
- appendfile(filename,tostring(gettime("24h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
- else appendfile(filename,tostring(gettime("12h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
- end
- else appendfile(filename,tostring(table["message"]) .."\n")
- end
- end
- end
- end
- end
- end
- dump()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement