Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local httpservice = game:GetService("HttpService") -- Define HTTP Service
- local serverstorage = game:GetService("ServerStorage") -- Define Server Storgage
- local webhook = "webhook here" -- Webhook URL
- local modules = serverstorage:WaitForChild("ServerModules",100) -- Server modules folder
- local utility = require(modules:WaitForChild("Utility"),100) -- seoncdstoHMS function
- function sendwebhook(msg,name,id) -- Used for sending webhooks
- local data = {
- content = msg;
- username = name;
- avatar_url = "http://www.roblox.com/Thumbs/Avatar.ashxx=100&y=100&Format=Png&userId="..id
- }
- httpservice:PostAsync(webhook, httpservice:JSONEncode(data))
- end
- game.Players.PlayerAdded:Connect(function(plr)
- if plr:GetRankInGroup(6622873) >= 251 then -- Are they a mod?
- local sessiontime = Instance.new("IntValue") -- Make the time value
- sessiontime.Name = "SessionTime"
- sessiontime.Value = 0
- sessiontime.Parent = plr
- sendwebhook(plr.Name.." has started a session!",plr) -- Send to the activity log
- spawn(function() -- Seperate thread, for general conveinence
- while wait(1) do
- sessiontime.Value = sessiontime.Value + 1 -- Track the time!
- end
- end)
- end
- end)
- game.Players.PlayerRemoving:Connect(function(plr)
- if plr:GetRankInGroup(6622873) >= 251 then -- Are they a mod?
- sendwebhook(plr.Name.." has ended their session. Session time: "..utility.seoncdstoHMS(plr.SessionTime.Value),plr.UserId,plr.Name) -- Send the session time to the logs
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement