MaxproGlitcher

séparateur de message test

Oct 27th, 2024
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.56 KB | None | 0 0
  1. --[[
  2. WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your own risk!
  3. ]]
  4. -- i hate string manipulation, causes headaches every time
  5. function findlast(str,fstr)
  6. local rstr = string.reverse(str)
  7. local rfstr = string.reverse(fstr)
  8. local fstart,fend = string.find(rstr,rfstr)
  9. local rfstart,rfend = (string.len(str)-fend)+1,(string.len(str)-fstart)+1
  10. return rfstart,rfend
  11. end
  12. function splitwords(txt,stopatwordends,chrcap)
  13. local amttodo = string.len(txt)/chrcap
  14. local amt = 0
  15. local rettable = {}
  16. local tr = true
  17. while tr do
  18. print(amttodo)
  19. local oldamt = amt
  20. if amttodo < 1 then
  21. amt = amt + amttodo*chrcap
  22. print("amt",amt)
  23. else
  24. amt = amt + chrcap
  25. end
  26. print(oldamt,amt)
  27. local newtxt = string.sub(txt,oldamt,amt)
  28. if stopatwordends and amttodo > 1 then
  29. local pos = findlast(newtxt," ")
  30. if pos then
  31. newtxt = string.sub(newtxt,oldamt,pos)
  32. end
  33. end
  34. if string.len(newtxt) > 0 then
  35. table.insert(rettable,newtxt)
  36. end
  37. amttodo = amttodo - 1
  38. if amttodo <= 0 then
  39. tr = false
  40. end
  41. end
  42. return rettable
  43. end
  44. function gettable(txt,chrcap,stopatwordends,newlines)
  45. if chrcap == nil then
  46. chrcap = 199
  47. end
  48. if stopatwordends == nil then
  49. stopatwordends = false
  50. end
  51. if newlines == nil then
  52. newlines = true
  53. end
  54. local rettable = {}
  55. if newlines and #string.split(txt,"\n") > 1 then
  56. for i,v in pairs(string.split(txt,"\n")) do
  57. if v ~= nil and v ~= "" then
  58. if string.len(v) > chrcap then
  59. local spltable = splitwords(v,stopatwordends,chrcap)
  60. for i,v in pairs(spltable) do
  61. table.insert(rettable,v)
  62. end
  63. else
  64. table.insert(rettable,v)
  65. end
  66. end
  67. end
  68. else
  69. if string.len(txt) > chrcap then
  70. local spltable = splitwords(txt,stopatwordends,chrcap)
  71. for i,v in pairs(spltable) do
  72. table.insert(rettable,v)
  73. end
  74. else
  75. table.insert(rettable,txt)
  76. end
  77. end
  78. for i,v in pairs(rettable) do
  79. print(i,v,string.len(v))
  80. end
  81. return rettable
  82. end
  83. local textservice = game:GetService("TextService")
  84. local textcservice = game:GetService("TextChatService")
  85. function say(txt,channel)
  86. local success,err = pcall(function()
  87. if textcservice.ChatVersion == Enum.ChatVersion.TextChatService then
  88. textcservice:FindFirstChildWhichIsA("ChatInputBarConfiguration").TargetTextChannel:SendAsync(txt)
  89. else
  90. game.ReplicatedStorage.DefaultChatSystemChatEvents.SayMessageRequest:FireServer(txt,channel or "All")
  91. end
  92. end)
  93. end
  94. local ot = false
  95. pcall(function()
  96. local Notify = function(_Title, _Text , Time)
  97. game.StarterGui:SetCore("SendNotification", {Title = _Title, Text = _Text, Icon = "rbxassetid://2541869220", Duration = Time})
  98. end
  99. local Metatable = getrawmetatable(game.StarterGui)
  100. setreadonly(Metatable, false)
  101. local event = require(localplr.PlayerScripts:FindFirstChild("ChatMain",true)).MessagePosted
  102. local oldfunc
  103. oldfunc = hookfunction(event.fire,function(a1,a2,a3)
  104. local args = {a1,a2,a3}
  105. if ot and args[1] == event then
  106. return nil
  107. else
  108. return oldfunc(table.unpack(args))
  109. end
  110. end)
  111. end)
  112. local ids = {}
  113. local idnum = 0
  114. function saytable(tab,delay,antichatlog)
  115. if antichatlog == nil then
  116. antichatlog = true
  117. end
  118. if delay == nil then
  119. delay = 5
  120. end
  121. if antichatlog then
  122. ot = true
  123. end
  124. idnum = idnum + 1
  125. local currid = idnum
  126. ids[currid] = true
  127. coroutine.wrap(function()
  128. for i,v in pairs(tab) do
  129. if ids[currid] == false then
  130. continue
  131. end
  132. local saytxt = v
  133. say(saytxt)
  134. wait(delay)
  135. end
  136. if antichatlog then
  137. ot = false
  138. end
  139. end)()
  140. return currid
  141. end
  142. function stopsaying(id)
  143. ids[id] = false
  144. end
  145. local rettable = {}
  146. rettable.getmessages = gettable
  147. rettable.saymessages = saytable
  148. rettable.say = say
  149. rettable.splitwords = splitwords
  150. rettable.findlast = findlast
  151. rettable.stopsaying = stopsaying
  152. return rettable
Advertisement
Add Comment
Please, Sign In to add comment