Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple Slur Blocker
#1
Here's a simple script that prevents a message containing anything in that table from getting sent. Drop it in lua/autorun and you're off to the races. If we get the timed mutes/gags addon I wrote installed, it would be very easy to have this automatically mute the player for a few minutes if they send a message that gets blocked, if we wanted to.

https://github.com/RussEfarmer/bad-word-slur-blocker
https://github.com/RussEfarmer/bad-word-...e/automute

Code:
badwords = {
    "badword1",
    "badword2",
    "badword3",
    "badword4",
    "badword5" -- don't put a comma on the last one
}

function findBadWords(table, text)
    for k,v in pairs(table) do
        if string.find(text, v) then return true end
    end
end

if SERVER then
    hook.Remove("PlayerSay", "nobadword")
    hook.Add( "PlayerSay", "nobadword", function(ply, text)
        if findBadWords(badwords, text) then return "" end
    end)
end


Messages In This Thread
Simple Slur Blocker - by RussEfarmer - 02-20-2021, 02:52 AM
RE: Simple Slur Blocker - by Deer-ly - 02-20-2021, 03:01 AM
RE: Simple Slur Blocker - by two rats kissing - 02-20-2021, 03:05 AM
RE: Simple Slur Blocker - by RussEfarmer - 02-20-2021, 03:06 AM
RE: Simple Slur Blocker - by bryanbrr - 02-20-2021, 08:48 AM
RE: Simple Slur Blocker - by derp sucks - 02-20-2021, 09:39 AM
RE: Simple Slur Blocker - by Jammin - 02-20-2021, 10:45 AM
RE: Simple Slur Blocker - by Battons - 02-20-2021, 12:46 PM
RE: Simple Slur Blocker - by Mana - 02-20-2021, 02:11 PM
RE: Simple Slur Blocker - by RussEfarmer - 02-20-2021, 02:31 PM
RE: Simple Slur Blocker - by Jammin - 02-20-2021, 02:38 PM
RE: Simple Slur Blocker - by RussEfarmer - 02-20-2021, 02:51 PM
RE: Simple Slur Blocker - by Knee Coal Bowlass - 02-20-2021, 05:08 PM
RE: Simple Slur Blocker - by RussEfarmer - 02-21-2021, 03:17 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)

About Us
    This is Dinkleberg's GMod, a gaming community based in Garry's Mod. We have a Trouble in Terrorist Town, Prop Hunt, Murder, and Deathrun Server. Come check them out sometime.