Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your own risk!
- ]]
- -- i hate string manipulation, causes headaches every time
- function findlast(str,fstr)
- local rstr = string.reverse(str)
- local rfstr = string.reverse(fstr)
- local fstart,fend = string.find(rstr,rfstr)
- local rfstart,rfend = (string.len(str)-fend)+1,(string.len(str)-fstart)+1
- return rfstart,rfend
- end
- function splitwords(txt,stopatwordends,chrcap)
- local amttodo = string.len(txt)/chrcap
- local amt = 0
- local rettable = {}
- local tr = true
- while tr do
- print(amttodo)
- local oldamt = amt
- if amttodo < 1 then
- amt = amt + amttodo*chrcap
- print("amt",amt)
- else
- amt = amt + chrcap
- end
- print(oldamt,amt)
- local newtxt = string.sub(txt,oldamt,amt)
- if stopatwordends and amttodo > 1 then
- local pos = findlast(newtxt," ")
- if pos then
- newtxt = string.sub(newtxt,oldamt,pos)
- end
- end
- if string.len(newtxt) > 0 then
- table.insert(rettable,newtxt)
- end
- amttodo = amttodo - 1
- if amttodo <= 0 then
- tr = false
- end
- end
- return rettable
- end
- function gettable(txt,chrcap,stopatwordends,newlines)
- if chrcap == nil then
- chrcap = 199
- end
- if stopatwordends == nil then
- stopatwordends = false
- end
- if newlines == nil then
- newlines = true
- end
- local rettable = {}
- if newlines and #string.split(txt,"\n") > 1 then
- for i,v in pairs(string.split(txt,"\n")) do
- if v ~= nil and v ~= "" then
- if string.len(v) > chrcap then
- local spltable = splitwords(v,stopatwordends,chrcap)
- for i,v in pairs(spltable) do
- table.insert(rettable,v)
- end
- else
- table.insert(rettable,v)
- end
- end
- end
- else
- if string.len(txt) > chrcap then
- local spltable = splitwords(txt,stopatwordends,chrcap)
- for i,v in pairs(spltable) do
- table.insert(rettable,v)
- end
- else
- table.insert(rettable,txt)
- end
- end
- for i,v in pairs(rettable) do
- print(i,v,string.len(v))
- end
- return rettable
- end
- local textservice = game:GetService("TextService")
- local textcservice = game:GetService("TextChatService")
- function say(txt,channel)
- local success,err = pcall(function()
- if textcservice.ChatVersion == Enum.ChatVersion.TextChatService then
- textcservice:FindFirstChildWhichIsA("ChatInputBarConfiguration").TargetTextChannel:SendAsync(txt)
- else
- game.ReplicatedStorage.DefaultChatSystemChatEvents.SayMessageRequest:FireServer(txt,channel or "All")
- end
- end)
- end
- local ot = false
- pcall(function()
- local Notify = function(_Title, _Text , Time)
- game.StarterGui:SetCore("SendNotification", {Title = _Title, Text = _Text, Icon = "rbxassetid://2541869220", Duration = Time})
- end
- local Metatable = getrawmetatable(game.StarterGui)
- setreadonly(Metatable, false)
- local event = require(localplr.PlayerScripts:FindFirstChild("ChatMain",true)).MessagePosted
- local oldfunc
- oldfunc = hookfunction(event.fire,function(a1,a2,a3)
- local args = {a1,a2,a3}
- if ot and args[1] == event then
- return nil
- else
- return oldfunc(table.unpack(args))
- end
- end)
- end)
- local ids = {}
- local idnum = 0
- function saytable(tab,delay,antichatlog)
- if antichatlog == nil then
- antichatlog = true
- end
- if delay == nil then
- delay = 5
- end
- if antichatlog then
- ot = true
- end
- idnum = idnum + 1
- local currid = idnum
- ids[currid] = true
- coroutine.wrap(function()
- for i,v in pairs(tab) do
- if ids[currid] == false then
- continue
- end
- local saytxt = v
- say(saytxt)
- wait(delay)
- end
- if antichatlog then
- ot = false
- end
- end)()
- return currid
- end
- function stopsaying(id)
- ids[id] = false
- end
- local rettable = {}
- rettable.getmessages = gettable
- rettable.saymessages = saytable
- rettable.say = say
- rettable.splitwords = splitwords
- rettable.findlast = findlast
- rettable.stopsaying = stopsaying
- return rettable
Advertisement
Add Comment
Please, Sign In to add comment