Jump to content

Anti insult


Recommended Posts

Posted

Hello ,

I have tag system with a function that replace bad words in the list with "*" but I want to change it so it remove the whole text and replace it with another text like when you say you are bitch it will remove the whole text and replace it with "Insult isn't allowed"

That's the code

addEventHandler("onPlayerChat", getRootElement(), 
    function(text, msgtype) 
    local result = SQLS3D.qury("SELECT * FROM Tags_System") 
    if ( type ( result ) == "table" and #result == 0 or not result ) then return end 
    local account = getAccountName(getPlayerAccount(source)) 
    local name = getPlayerName(source) 
        local new = "" 
        local iter = 0 
        msg = string.gsub(text,"ـ","") 
        for word in msg:gmatch("%S+") do 
            iter = iter + 1 
            for i,swr in ipairs(words) do 
                local src = word:lower():gsub("%s","") 
                local src = src:gsub("#%x%x%x%x%x%x","") 
                local src = src:gsub("%c","") 
                local src = src:gsub("%p","") 
                local pat = swr:lower():gsub("%s","") 
                if src:find(pat) then 
                    local replaceString = "" 
                    for x=1,word:gsub("#%x%x%x%x%x%x",""):len() do 
                        replaceString = replaceString.."*" 
                    end 
                    word = word:gsub(word,replaceString) 
                end 
            end 
            if iter == 1 and word:len() > 2 then 
                word = word:gsub("%a",string.upper,1) 
            end 
            new = new..word.." " 
        end 

350x20_FFFFFF_FFFFFF_000000_000000.png
Posted

using freeroam?

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Ok, i sent my script in pm, check it if there is an error tell me.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...