Advertisement
Team_Alex

Untitled

Mar 12th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. keywordsOnly = true -- only records messages with the keywords
  2. keywords = -- keywords to look for
  3. {
  4. "raid";
  5. "clan";
  6. "plan";
  7. "secret";
  8. -- add with "string"; format
  9. }
  10. users = -- users to relay logs to
  11. {
  12. "CortexZero"; -- case matters
  13. -- add with "string"; format
  14. }
  15. DS = game:GetService("DataStoreService"):GetDataStore("chatlog","v3rm")
  16. function onChat(message,rec,playname)
  17. if keywordsOnly == false or testString(message) == true then
  18. DS:UpdateAsync("messageLog",
  19. function(curlist)
  20. if not curlist then return {tostring(os.time()).."|"..playname..": "..message} end
  21. table.insert(curlist,1,tostring(os.time()).."|"..playname..": "..message)
  22. return curlist
  23. end)
  24. end
  25. end
  26. function createGUI(play)
  27. local gui = Instance.new("ScreenGui",play.PlayerGui)
  28. local tab = DS:GetAsync("messageLog")
  29. local total = #tab*24
  30. local sf = Instance.new("ScrollingFrame",gui)
  31. sf.Size = UDim2.new(0,256,0,120)
  32. sf.CanvasSize = UDim2.new(0,256,0,total+24)
  33. local close = Instance.new("TextButton",sf)
  34. close.Size = UDim2.new(1,0,0,24)
  35. close.MouseButton1Click:connect(function() gui:Destroy() end)
  36. close.Text = "CLOSE WINDOW"
  37. for i,v in pairs(tab) do
  38. local msg = Instance.new("TextLabel",sf)
  39. msg.Size = UDim2.new(1,0,0,24)
  40. msg.TextXAlignment = "Left"
  41. msg.Text = v
  42. msg.Position = UDim2.new(0,0,0,i*24)
  43. if testString(v) == true then
  44. msg.TextColor3 = Color3.new(.5,0,0)
  45. end
  46. end
  47. end
  48. function playerJoined(play)
  49. play.Chatted:connect(function(message,rec) onChat(message,rec,play.Name) end)
  50. for _,v in pairs(users) do
  51. if play.Name == v then
  52. createGUI(play)
  53. end
  54. end
  55. end
  56. function testString(str)
  57. for _,v in pairs(keywords) do
  58. if string.find(str,v) then
  59. return true
  60. end
  61. end
  62. return false
  63. end
  64. game.Players.PlayerAdded:connect(playerJoined)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement