Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TCS = game:GetService("TextChatService")
- local CS = game:GetService("Chat")
- local P = game:GetService("Players")
- local HS = game:GetService("HttpService")
- local MS = game:GetService("MessagingService")
- local RS = game:GetService("ReplicatedStorage")
- local SSS = script.Parent
- local EM = require(SSS.ServerEvent)
- local queue = {}
- local max = 25
- local function log(character, message)
- local player = P:GetPlayerFromCharacter(character)
- if player:FindFirstChild("DisplayPlayerName") and player.DisplayPlayerName.Value ~= "" then
- local nickname = player:FindFirstChild("DisplayPlayerName").Value
- table.insert(
- queue,
- player.Name .. " [@" .. nickname .. "] (" .. player.UserId .. "): ``" .. message.Text .. "``"
- )
- else
- table.insert(queue, player.Name .. " (" .. player.UserId .. "): ``" .. message.Text .. "``")
- end
- if #queue >= max then
- local outputstr = "Chat log for <t:"
- .. DateTime.now().UnixTimestamp
- .. ":f> ("
- .. game.JobId
- .. "/"
- .. game.PrivateServerId
- .. "):"
- for k, v in ipairs(queue) do
- outputstr = outputstr .. "\n" .. v
- end
- HS:PostAsync(
- "yikes",
- HS:JSONEncode({
- content = outputstr,
- })
- )
- queue = {}
- end
- end
- P.PlayerAdded:Connect(function(plr)
- plr.Chatted:Connect(function(msg)
- log(plr.Character, { Text = msg })
- end)
- end)
- SSS.CMDInit.Events.forceChatlogSend.Event:Connect(function()
- local outputstr = "Chat log for <t:"
- .. DateTime.now().UnixTimestamp
- .. ":f> ("
- .. game.JobId
- .. "/"
- .. game.PrivateServerId
- .. "):"
- for k, v in ipairs(queue) do
- outputstr = outputstr .. "\n" .. v
- end
- HS:PostAsync(
- "yikes",
- HS:JSONEncode({
- content = outputstr,
- })
- )
- queue = {}
- end)
- SSS.CMDInit.Events.changeChatlogLimit.Event:Connect(function(newlimit)
- max = newlimit
- end)
- MS:SubscribeAsync("GCLDiscord", function(msg)
- local sessiontitle = "KPMI"
- local clr
- local pmsg = msg.Data
- local function parse()
- if string.sub(pmsg, 1, 5) == "[/CLR" then
- clr = "Color3|" .. string.split(string.split(pmsg, "[/CLR")[2], "]")[1]
- local out = string.split(pmsg, "]")
- table.remove(out, 1)
- pmsg = table.concat(out, "]")
- elseif string.sub(pmsg, 1, 4) == "[/DB" then
- workspace.Events.BarrierEnabled.Value = false
- -- wait for prim and his magic to make this work fully
- pmsg = string.sub(pmsg, 6)
- elseif string.sub(pmsg, 1, 4) == "[/EB" then
- workspace.Events.BarrierEnabled.Value = true
- -- wait for prim and his magic to make this work fully
- pmsg = string.sub(pmsg, 6)
- elseif string.sub(pmsg, 1, 3) == "[/B" then
- task.spawn(function()
- EM.BlackoutEvent(tonumber(string.split(string.split(pmsg, "[/B")[2], "]")[1]))
- end)
- local out = string.split(pmsg, "]")
- table.remove(out, 1)
- pmsg = table.concat(out, "]")
- elseif string.sub(pmsg, 1, 3) == "[/P" then
- task.spawn(function()
- EM.PowerOutageEvent(tonumber(string.split(string.split(pmsg, "[/P")[2], "]")[1]))
- end)
- local out = string.split(pmsg, "]")
- table.remove(out, 1)
- pmsg = table.concat(out, "]")
- elseif string.sub(pmsg, 1, 4) == "[/PU" then
- task.spawn(function()
- EM.PurificationEvent()
- end)
- pmsg = string.sub(pmsg, 6)
- elseif string.sub(pmsg, 1, 4) == "[/EX" then
- task.spawn(function()
- EM.ExterminationEvent()
- end)
- pmsg = string.sub(pmsg, 6)
- elseif string.sub(pmsg, 1, 3) == "[A|" then
- RS.Remote.GCLMessage:FireAllClients(
- "[" .. sessiontitle .. "]: " .. string.split(string.split(pmsg, "[A|")[2], "]")[1],
- clr
- )
- local out = string.split(pmsg, "]")
- table.remove(out, 1)
- pmsg = table.concat(out, "]")
- elseif string.sub(pmsg, 1, 4) == "[/DL" then
- task.wait(tonumber(string.split(string.split(pmsg, "[/DL")[2], "]")[1]))
- local out = string.split(pmsg, "]")
- table.remove(out, 1)
- pmsg = table.concat(out, "]")
- elseif string.sub(pmsg, 1, 3) == "[T|" then
- sessiontitle = string.split(string.split(pmsg, "[T|")[2], "]")[1]
- local out = string.split(pmsg, "]")
- table.remove(out, 1)
- pmsg = table.concat(out, "]")
- else
- print("reached end condition")
- return
- end
- print("continuing")
- parse()
- end
- print("initializing")
- parse()
- if pmsg ~= "" then
- print("attempting to send message")
- RS.Remote.GCLMessage:FireAllClients("[" .. sessiontitle .. "]: " .. pmsg, clr)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment