Advertisement
spidey_v6

Untitled

Jan 6th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.28 KB | None | 0 0
  1. --you will vomit looking at how bad this scripting is
  2. if not appendfile and readfile and writefile then warn("incompatible") else
  3.  
  4. function gettime(format,ts)
  5. if ts then
  6. local currenttime = ""
  7. currenttime = os.date("*t",ts)["year"] .."/"
  8. currenttime = currenttime ..os.date("*t",ts)["month"] .."/"
  9. currenttime = currenttime ..os.date("*t",ts)["day"] .." "
  10. --12h time part
  11. if format == "24h" then
  12. currenttime = currenttime ..os.date("*t",ts)["hour"] ..":"
  13. else
  14. if tonumber(os.date("*t",ts)["hour"]) >12 then
  15. currenttime = currenttime ..tonumber(os.date("*t",ts)["hour"] - 12) ..":"
  16. else
  17. currenttime = currenttime ..os.date("*t",ts)["hour"] ..":"
  18. end
  19. end
  20. --adds a 0 if the time is under 10m
  21. if tonumber(os.date("*t",ts)["min"]) <10 then
  22. currenttime = currenttime ..0 ..os.date("*t",ts)["min"] ..":"
  23. else
  24. currenttime = currenttime ..os.date("*t",ts)["min"] ..":"
  25. end
  26. --adds a 0 if the time is under 10s
  27. if tonumber(os.date("*t",ts)["sec"]) <10 then
  28. currenttime = currenttime ..0 ..os.date("*t",ts)["sec"]
  29. else
  30. currenttime = currenttime ..os.date("*t",ts)["sec"]
  31. end
  32. -- adds am/pm
  33. if not format or format == "12h" then
  34. if tonumber(os.date("*t",ts)["hour"]) >11 then
  35. currenttime = currenttime .."PM"
  36. else currenttime = currenttime .."AM"
  37. end
  38. end
  39. return currenttime
  40. else
  41.  
  42.  
  43. local currenttime = ""
  44. currenttime = os.date("*t")["year"] .."/"
  45. currenttime = currenttime ..os.date("*t")["month"] .."/"
  46. currenttime = currenttime ..os.date("*t")["day"] .." "
  47. --12h time part
  48. if format == "24h" then
  49. currenttime = currenttime ..os.date("*t")["hour"] ..":"
  50. else
  51. if tonumber(os.date("*t")["hour"]) >12 then
  52. currenttime = currenttime ..tonumber(os.date("*t")["hour"] - 12) ..":"
  53. else
  54. currenttime = currenttime ..os.date("*t")["hour"] ..":"
  55. end
  56. end
  57. --adds a 0 if the time is under 10m
  58. if tonumber(os.date("*t",ts)["min"]) <10 then
  59. currenttime = currenttime ..0 ..os.date("*t",ts)["min"] ..":"
  60. else
  61. currenttime = currenttime ..os.date("*t",ts)["min"] ..":"
  62. end
  63. --adds a 0 if the time is under 10s
  64. if tonumber(os.date("*t")["sec"]) <10 then
  65. currenttime = currenttime ..0 ..os.date("*t")["sec"]
  66. else
  67. currenttime = currenttime ..os.date("*t")["sec"]
  68. end
  69. -- adds am/pm
  70. if not format or format == "12h" then
  71. if tonumber(os.date("*t")["hour"]) >11 then
  72. currenttime = currenttime .."PM"
  73. else currenttime = currenttime .."AM"
  74. end
  75. end
  76. return currenttime
  77. end
  78. end
  79.  
  80. function dump()
  81. if appendtofile then
  82. pcall(function() file = readfile("DevConsoleDump.txt") end)
  83. if file ~= nil then
  84. if use24h then
  85. appendfile("DevConsoleDump.txt","ClientDump at "..gettime("24h") .."\n")
  86. else
  87. appendfile("DevConsoleDump.txt","ClientDump at "..gettime() .."\n")
  88. end
  89. else
  90. writefile("DevConsoleDump.txt","")
  91. wait()
  92. if use24h then
  93. appendfile("DevConsoleDump.txt","\n" .."ClientDump at "..gettime("24h") .."\n")
  94. else
  95. appendfile("DevConsoleDump.txt","\n" .."ClientDump at "..gettime() .."\n")
  96. end
  97. end
  98. for i,v in ipairs(game:GetService("LogService"):GetLogHistory()) do
  99. local table = v
  100. if tostring(table["messageType"]) == "Enum.MessageType.MessageOutput" and writeprints then
  101. if timestamps then
  102. if use24h then
  103. appendfile("DevConsoleDump.txt",tostring(gettime("24h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
  104. else appendfile("DevConsoleDump.txt",tostring(gettime("12h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
  105. end
  106. else appendfile("DevConsoleDump.txt",tostring(table["message"]) .."\n")
  107. end
  108.  
  109. elseif tostring(table["messageType"]) == "Enum.MessageType.MessageWarning" and writewarns then
  110. if timestamps then
  111. if use24h then
  112. appendfile("DevConsoleDump.txt",tostring(gettime("24h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
  113. else appendfile("DevConsoleDump.txt",tostring(gettime("12h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
  114. end
  115. else appendfile("DevConsoleDump.txt",tostring(table["message"]) .."\n")
  116. end
  117.  
  118. elseif tostring(table["messageType"]) == "Enum.MessageType.MessageError" and writeerrors then
  119. if timestamps then
  120. if use24h then
  121. appendfile("DevConsoleDump.txt",tostring(gettime("24h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
  122. else appendfile("DevConsoleDump.txt",tostring(gettime("12h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
  123. end
  124. else appendfile("DevConsoleDump.txt",tostring(table["message"]) .."\n")
  125. end
  126.  
  127. end
  128. end
  129.  
  130. else
  131. if use24h then
  132. filename = "Console " ..tostring(gettime("24h")):gsub(":",""):gsub("/","-") ..".txt"
  133. else
  134. filename = "Console " ..tostring(gettime()):gsub(":",""):gsub("/","-") ..".txt"
  135. end
  136. writefile(filename,"")
  137.  
  138. for i,v in ipairs(game:GetService("LogService"):GetLogHistory()) do
  139. local table = v
  140. if tostring(table["messageType"]) == "Enum.MessageType.MessageOutput" and writeprints then
  141. if timestamps then
  142. if use24h then
  143. appendfile(filename,tostring(gettime("24h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
  144. else appendfile(filename,tostring(gettime("12h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
  145. end
  146. else appendfile(filename,tostring(table["message"]) .."\n")
  147. end
  148.  
  149. elseif tostring(table["messageType"]) == "Enum.MessageType.MessageWarning" and writewarns then
  150. if timestamps then
  151. if use24h then
  152. appendfile(filename,tostring(gettime("24h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
  153. else appendfile(filename,tostring(gettime("12h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
  154. end
  155. else appendfile(filename,tostring(table["message"]) .."\n")
  156. end
  157.  
  158. elseif tostring(table["messageType"]) == "Enum.MessageType.MessageError" and writeerrors then
  159. if timestamps then
  160. if use24h then
  161. appendfile(filename,tostring(gettime("24h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
  162. else appendfile(filename,tostring(gettime("12h",table["timestamp"])) .." -- " ..tostring(table["message"]) .."\n")
  163. end
  164. else appendfile(filename,tostring(table["message"]) .."\n")
  165. end
  166.  
  167. end
  168. end
  169. end
  170.  
  171. end
  172. end
  173. dump()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement