Chat spam block/Cooldown.

I’m not exactly great at Lua, and I’d really appreciate it if someone could quickly whip up a script that would block chat spam.

Lets say a player types a message, then instantly afterwards types somthing else. Could it display a message to the spammer in chat, like “Don’t spam, use one scentince to convey messages.”? I’m not too sure what the value for cooldown should be, I was thinking around 2 seconds?

Thanks for reading, and I hope you can help. I’d really appreciate it.

I almost forgot, could the antispam detect the same word being said in succession? That would be a great way to cut down on repetitive spam.

Bump for atleast a suggestion?

Look at this

with this

Don’t use the think function, just the code.

I have no idea how to get those two examples to do what I want.

-- Think Link
NextPrintTime = 0
function SecondPrint()
    if (CurTime() >= NextPrintTime) then
        Msg("This is printed every second
        NextPrintTime = CurTime() + 1
hook.Add("Think", "SecondPrint", SecondPrint)

-- PlayerSay Link
function ISaid( ply, text, team, death )
    if (string.sub(text, 1, 4) == "/all") then--if the first 4 letters are /all continue
        return "[Global]"..string.sub( text, 5 );--add [Global] infront of the players text then display
hook.Add( "PlayerSay", "ISaid", ISaid );

-- Merged
NextSayTime = 0
function WaitLUL(ply)
	NextSayTime = CurTime() + 5
hook.Add( "PlayerSay", "u no spam", WaitLUL)

Something like that.