Advertisement
Guest User

ChatLog System

a guest
Feb 25th, 2020
1,260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.93 KB | None | 0 0
  1. -- Scripted by :lameckluiz --
  2. --[[Chatlog Sytem]]--
  3.  
  4. --//Variables
  5.  
  6. local Players = game:GetService("Players")
  7. local HttpService = game:GetService("HttpService")
  8. local disabled = false
  9. local DisCommand = false
  10. local groupid = 4961761
  11. local grouprank = 255
  12. local group = true
  13. local webhook = "https://discordapp.com/api/webhooks/651808243328221184/YTIeKrR6cl52ufpR4mNziJhW3hQUg-L_wblKmKWjyA1AqosLVL-9ODYAXZGgEs4aao6o"
  14. local access = {"Player1","Player2","Player3"}
  15. local Command1 = ":chat on"
  16. local Command2 = "/e :chat on"
  17. local Command3 = ":chat off"
  18. local Command4 = "/e :chat off"
  19.  
  20.  --// Functions/Runners
  21.  
  22. function contains(plrname)
  23.     for _, v in pairs(access) do
  24.         if v == plrname then return true end
  25.     end
  26.     return false
  27. end
  28.  
  29. Players.PlayerAdded:Connect(function(plr)
  30.     plr.Chatted:Connect(function(msg)
  31.         if disabled == false then
  32.             if DisCommand == false then
  33.                 local data = {
  34.                     content = msg;
  35.                     username = plr.Name .. " - (#" .. plr.UserId .. ")";
  36.                     avatar_url = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userId="..plr.UserId
  37.                 }
  38.                 HttpService:PostAsync(webhook, HttpService:JSONEncode(data))
  39.             elseif DisCommand == true then
  40.                 if msg ~= Command1 and msg ~= Command2 and msg ~= Command3 and msg ~= Command4 then
  41.                 local data = {
  42.                     content = msg;
  43.                     username = plr.Name .. " - (#" .. plr.UserId .. ")";
  44.                     avatar_url = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userId="..plr.UserId
  45.                 }
  46.                 HttpService:PostAsync(webhook, HttpService:JSONEncode(data))
  47.                 end
  48.             end
  49.         end
  50.     end)
  51. end)
  52.  
  53. Players.PlayerAdded:connect(function(Player)
  54.     if group == true then
  55.         if Player:GetRankInGroup(groupid) >= grouprank then
  56.             Player.Chatted:Connect(function(msg)
  57.                 if msg:lower() == Command1 or msg:lower() == Command2 then
  58.                     disabled = false
  59.                     print("Chat logs activated")
  60.                 end
  61.                 if msg:lower() == Command3 or msg:lower() == Command4 then
  62.                     disabled = true
  63.                     print("Chat logs deactivated")
  64.                 end    
  65.             end)
  66.         end
  67.     elseif group == false then
  68.         if contains(Player.Name) then
  69.             Player.Chatted:Connect(function(msg)
  70.                 if msg:lower() == Command1 or msg:lower() == Command2 then
  71.                     disabled = false
  72.                     print("Chat logs activated")
  73.                 end
  74.                 if msg:lower() == Command3 or msg:lower() == Command4 then
  75.                     disabled = true
  76.                     print("Chat logs deactivated")
  77.                 end    
  78.             end)
  79.         end
  80.     end
  81. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement