Jump to content

[help]block specific work


Recommended Posts

Im using onClientChat for input detection.

Theres a list of swear words:

  
bWords = {["cfi"]=true,["msi"]=true}  

And check algorithm:

function replaceBW(text,r,g,b) 
    local changed = false 
    local concat = split ( text, ' ' ) 
    for i,v in ipairs(concat)do 
        local testword = string.gsub(v,'%p','') --remove commas etc. 
        if bWords[v] or bWords[string.lower(testword)] then 
            concat[i] = string.rep('*',string.len(testword))..string.gsub(v,'%a','') 
            changed = true 
        end 
    end 
    if changed then 
        cancelEvent() 
        text = table.concat(concat,' ') 
        outputChatBox(text,r,g,b,true) 
    end 
end 

It's fast enough

Words like CFIS will not be blocked tho cause of this check method simplicity and decency.

Link to comment

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...