Gerard_games

Tracker webhook

Oct 24th, 2021 (edited)
2,592
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.81 KB | None | 0 0
  1. if game.PlaceId == 6284583030 or game.PlaceId == 7722306047 then
  2. repeat wait() until game:isLoaded()
  3. repeat wait() until game:GetService("Players")
  4. repeat wait() until game:GetService("Players").LocalPlayer
  5. repeat wait() until game:GetService("Players").LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
  6. repeat wait() until game:GetService("Players").LocalPlayer.PlayerGui.Main.Enabled
  7. repeat wait() until game:GetService("Workspace"):FindFirstChild("__MAP")
  8.  
  9. if (not getgenv().Settings.Webhooks or #getgenv().Settings.Webhooks == 0) or (getgenv().Settings.Webhooks[game.Players.LocalPlayer.UserId]) then
  10. function send(msg)
  11. Webhook = getgenv().Settings.Webhooks[game.Players.LocalPlayer.UserId] or getgenv().Settings.webhook
  12. request = http_request or request or HttpPost or syn.request
  13. request({Url = Webhook, Method = "POST", Headers = {["Content-Type"] = "application/json"}, Body = game.HttpService:JSONEncode(msg)})
  14. end
  15. local function timestamp(t)
  16. local data = os.date("!*t", t)
  17. return string.format("%04d-%02d-%02dT%02d:%02d:%02d.000Z", data.year, data.month, data.day, data.hour, data.min, data.sec)
  18. end
  19.  
  20. local sendtemptable = {
  21. ["content"] = "Starting the web hooking of stats";
  22. ["embeds"] = nil;
  23. ["username"] = "Your stats!";
  24. ["avatar_url"] = "https://cdn.discordapp.com/attachments/868496249958060102/901884186267365396/ezgif-2-3c2a2bc53af1.gif"
  25. }
  26. send(sendtemptable)
  27.  
  28. local TimeElapsed = 1
  29. local Colours = {
  30. ["Profile"] = 0x7771e8,
  31. ["Coins"] = 0xffee00,
  32. ["Fantasy Coins"] = 0xaaaab9,
  33. ["Tech Coins"] = 0x476084,
  34. ["Halloween Candy"] = 0xa345ff,
  35. ["Diamonds"] = 0x6af9fe
  36. }
  37. function SecondsToClock(seconds)
  38. local hours = math.floor(seconds / 3600 )
  39. seconds = seconds - hours * 3600
  40. local minutes = math.floor(seconds / 60)
  41. seconds = seconds - minutes * 60
  42. return string.format("%dh, %dm, %ds", hours, minutes, seconds)
  43. end
  44. function othersecondstoclockconverterforthingslol(seconds)
  45. local minutes = math.floor(seconds / 60)
  46. seconds = seconds - minutes * 60
  47. return string.format("%dm, %ds", minutes, seconds)
  48. end
  49. local GameLibrary = require(game:GetService("ReplicatedStorage"):WaitForChild("Framework"):WaitForChild("Library"))
  50. local SaveGot = GameLibrary.Save.Get()
  51. getgenv().CurrencyTracking = {
  52. ["CoinsFIRST"] = SaveGot.Coins;
  53. ["Fantasy CoinsFIRST"] = SaveGot['Fantasy Coins'];
  54. ["Tech CoinsFIRST"] = SaveGot['Tech Coins'];
  55. ["Halloween CandyFIRST"] = SaveGot['Halloween Candy'];
  56. ["DiamondsFIRST"] = SaveGot['Diamonds'];
  57.  
  58. ["Coins"] = 0;
  59. ["Fantasy Coins"] = 0;
  60. ["Tech Coins"] = 0;
  61. ["Halloween Candy"] = 0;
  62. ["Diamonds"] = 0;
  63.  
  64. ["CoinsLAST"] = SaveGot["Coins"];
  65. ["Fantasy CoinsLAST"] = SaveGot["Fantasy Coins"];
  66. ["Tech CoinsLAST"] = SaveGot["Tech Coins"];
  67. ["Halloween CandyLAST"] = SaveGot["Halloween Candy"];
  68. ["DiamondsLAST"] = SaveGot["Diamonds"];
  69.  
  70. ["CoinsTOTAL"] = 0;
  71. ["Fantasy CoinsTOTAL"] = 0;
  72. ["Tech CoinsTOTAL"] = 0;
  73. ["Halloween CandyTOTAL"] = 0;
  74. ["DiamondsTOTAL"] = 0;
  75. }
  76.  
  77. while wait(getgenv().Settings.Delay) do
  78. local SaveGot = GameLibrary.Save.Get()
  79. local BoostThing = ""
  80. if SaveGot.Boosts then
  81. local BoostNumThing = 1
  82. for i,v in pairs(SaveGot.Boosts) do
  83. BoostThing = BoostThing .. "`"..i.."` **".. SecondsToClock(v) .. "**\n"
  84. end
  85. end
  86. if BoostThing == "" then BoostThing = "⠀" end
  87. local OtherBoostThing = ""
  88. if SaveGot.BoostsInventory then
  89. local BoostNumThing = 1
  90. for i,v in pairs(SaveGot.BoostsInventory) do
  91. OtherBoostThing = OtherBoostThing .. "`"..i.."` **".. v .. "**\n"
  92. end
  93. end
  94.  
  95. local SelectedEggThing = getgenv().Settings.EggCalculator or 'Cracked Egg'
  96. local SelectedModuleEggThing = require(game:GetService("ReplicatedStorage").Game.Eggs["Spawn Eggs"]["Cracked Egg"]["Cracked Egg"])
  97. for i,v in pairs(game:GetService("ReplicatedStorage").Game.Eggs:GetDescendants()) do
  98. if v.ClassName == 'ModuleScript' and v.Name == getgenv().Settings.EggCalculator then
  99. SelectedModuleEggThing = require(v)
  100. end
  101. end
  102. local MaxEggThing = 'ERROR lol'
  103. MaxEggThing = GameLibrary.Functions.Commas(math.floor(SaveGot[SelectedModuleEggThing.currency] / SelectedModuleEggThing.cost))
  104.  
  105. local totalhatched = 0
  106. for i,v in pairs(SaveGot.EggsOpened) do
  107. totalhatched = totalhatched + v
  108. end
  109.  
  110. function GetProfileFieldsThing()
  111. local ProfileFields = {
  112. content = nil,
  113. embeds = {
  114. {
  115. title = "Misc Statistics",
  116. color = Colours["Profile"],
  117. fields = {
  118. {name = "Username:", value = (getgenv().Settings.HideUsername == false and game.Players.LocalPlayer[getgenv().Settings.NameType]) or tostring("||" .. game.Players.LocalPlayer[getgenv().Settings.NameType] .. "||"), inline = true},
  119. {name = "Rank:", value = tostring("`"..SaveGot.Rank.."`"), inline = true},
  120. {name = "Session Time:", value = "`"..tonumber(TimeElapsed).." minutes`", inline = true},
  121. {name = tostring("Max " .. SelectedEggThing .. ":"), value = "`"..MaxEggThing.."`", inline = true},
  122. {name = tostring("Total " .. SelectedEggThing .. ":"), value = "`" .. GameLibrary.Functions.Commas(SaveGot.EggsOpened[SelectedEggThing]) .. "`", inline = true},
  123. {name = "Total Eggs Opened", value = "`"..GameLibrary.Functions.Commas(totalhatched).."`", inline = true},
  124. {name = "Boosts Enabled", value = BoostThing, inline = true},
  125. {name = "Boosts Left", value = OtherBoostThing, inline = true},
  126. },
  127. timestamp = timestamp(os.time()),
  128. thumbnail = {
  129. url = "http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=150&Format=Png&username=" .. game.Players.LocalPlayer.Name
  130. }
  131. }
  132. },
  133. username = "Your stats!",
  134. avatar_url = "https://cdn.discordapp.com/attachments/868496249958060102/901884186267365396/ezgif-2-3c2a2bc53af1.gif"
  135. }
  136. return ProfileFields
  137. end
  138.  
  139. function GetCurrencyFieldSThing(Currency)
  140. local AssetIdImage = string.format("https://www.roblox.com/asset-thumbnail/image?assetId=%d&width=420&height=420&format=png", string.gsub(game:GetService("Players").LocalPlayer.PlayerGui.Main.Right[Currency].Icon.Image, "rbxassetid://", ""))
  141. local CurencyFieldsThing = {
  142. content = nil,
  143. embeds = {
  144. {
  145. title = tostring(Currency .. " (" .. GameLibrary.Functions.Commas(SaveGot[Currency]) .. ")"),
  146. color = Colours[Currency],
  147. fields = {
  148. {
  149. name = "Earned in the last "..othersecondstoclockconverterforthingslol(getgenv().Settings.Delay)..":",
  150. value = GameLibrary.Functions.Commas(math.floor(SaveGot[Currency] - getgenv().CurrencyTracking[Currency..'LAST'])),
  151. inline = getgenv().Settings.CompactCurrency or true
  152. },
  153. {
  154. name = "Earned this session:",
  155. value = GameLibrary.Functions.Commas(math.floor(SaveGot[Currency] - getgenv().CurrencyTracking[tostring(Currency.."FIRST")])),
  156. inline = getgenv().Settings.CompactCurrency or true
  157. },
  158. {
  159. name = "Session average:",
  160. value = GameLibrary.Functions.Commas(math.floor((SaveGot[Currency] - getgenv().CurrencyTracking[tostring(Currency.."FIRST")]) / TimeElapsed)),
  161. inline = getgenv().Settings.CompactCurrency or true
  162. }
  163. },
  164. timestamp = timestamp(os.time()),
  165. thumbnail = {
  166. url = AssetIdImage
  167. }
  168. }
  169. },
  170. username = "Your stats!",
  171. avatar_url = "https://cdn.discordapp.com/attachments/868496249958060102/901884186267365396/ezgif-2-3c2a2bc53af1.gif"
  172. }
  173. return CurencyFieldsThing
  174. end
  175.  
  176. for a,b in pairs(getgenv().Settings.TrackList) do
  177. if a == 'Profile' and b then
  178. send(GetProfileFieldsThing())
  179. elseif a ~= 'Profile' and b then
  180. send(GetCurrencyFieldSThing(a))
  181. end
  182. end
  183.  
  184. getgenv().CurrencyTracking["CoinsLAST"] = SaveGot.Coins
  185. getgenv().CurrencyTracking["Fantasy CoinsLAST"] = SaveGot['Fantasy Coins']
  186. getgenv().CurrencyTracking["Tech CoinsLAST"] = SaveGot['Tech Coins']
  187. getgenv().CurrencyTracking["Halloween CandyLAST"] = SaveGot['Halloween Candy']
  188. getgenv().CurrencyTracking["DiamondsLAST"] = SaveGot['Diamonds']
  189.  
  190. getgenv().CurrencyTracking["Coins"] = SaveGot.Coins - getgenv().CurrencyTracking["CoinsLAST"]
  191. getgenv().CurrencyTracking["Fantasy Coins"] = SaveGot['Fantasy Coins'] - getgenv().CurrencyTracking["Fantasy CoinsLAST"]
  192. getgenv().CurrencyTracking["Tech Coins"] = SaveGot['Tech Coins'] - getgenv().CurrencyTracking["Tech CoinsLAST"]
  193. getgenv().CurrencyTracking["Halloween Candy"] = SaveGot['Halloween Candy'] - getgenv().CurrencyTracking["Halloween CandyLAST"]
  194. getgenv().CurrencyTracking["Diamonds"] = SaveGot['Diamonds'] - getgenv().CurrencyTracking["DiamondsLAST"]
  195.  
  196. getgenv().CurrencyTracking["CoinsTOTAL"] = getgenv().CurrencyTracking['CoinsTOTAL'] + getgenv().CurrencyTracking["Coins"]
  197. getgenv().CurrencyTracking["Fantasy CoinsTOTAL"] = getgenv().CurrencyTracking['Fantasy CoinsTOTAL'] + getgenv().CurrencyTracking["Fantasy Coins"]
  198. getgenv().CurrencyTracking["Tech CoinsTOTAL"] = getgenv().CurrencyTracking['Tech CoinsTOTAL'] + getgenv().CurrencyTracking["Tech Coins"]
  199. getgenv().CurrencyTracking["Halloween CandyTOTAL"] = getgenv().CurrencyTracking['Halloween CandyTOTAL'] + getgenv().CurrencyTracking["Halloween Candy"]
  200. getgenv().CurrencyTracking["DiamondsTOTAL"] = getgenv().CurrencyTracking['DiamondsTOTAL'] + getgenv().CurrencyTracking["Diamonds"]
  201.  
  202. TimeElapsed = TimeElapsed + 1
  203. end
  204. end
  205. end
Add Comment
Please, Sign In to add comment