ID:267982
 
I need help to make a code that auto mutes spammers.
Well, depends on what you consider spamming. I consider it repetitively saying the same sentence or garbled words over and over...In that case, just record their last sentence in a variable, and then compare it to the new sentence, and if it matches mute/boot/ban or what ever you wish to do to them...
In response to Goku72
yeah, thats what i consider spamming. so can u give me an example.
In response to Buster Lee
That example right there should do what you want. It's pretty basic though, but you can build on it using the same concepts.
mob
var
muted=0
tmp
list
last_said=list()
proc
Talk(msg,format)
var
count=0
for(var/mob/player/P in players)
spawn()
P<<"<b>[format][msg]</b>"
for(var/t in src.last_said)
if(findtext(msg,t))
count++
src.last_said.Add(msg)
return count

verb
Say(txt as text|null)
var
format="[src.name] says:"
talk
if(!src.muted)
talk=src.Talk(txt,format)
if(talk>=3)
src.muted=1
spawn(1000)
src.muted=0
else
if(talk>=6)
del(src)
In response to Goku72
There are various problems with that.

First, and most importantly, you're saving what everyone has said in a list. That's going to get REALLY, REALLY big later on.

Second, if someone logs out before they get unmuted, they NEVER gets unmuted, unless if they spam again.

Third, you're giving him a code snippet, which he will immediately plug into his code, will have no clue what it does, and will later come asking how to change something.

To fix the first problem, you simply have a counter which increases after every message, and reduce it based on the time since the last message, which you determine using world.realtime. If it's too high, then you block the message.

To fix the second problem, you use the above method.

To fix the the third problem, you tell him WHAT to do, you don't hand him something similar to what he's asking for on a silver platter.