Jump to content

Spam System Python

Recommended Posts

M2 Download Center

Download Here ( Internal )

Hello guys,

A few months ago i made a spam system in python, it was a really shitty one , so yesterday i decided to make a better one... I know it is not hard to make one, and if its made in c++ is better, but for the people who cant make source modifications and don?t know python here is the system:
def __SendChatPacket(self, text, type):
# if text[0] == '/':
# pass
# else:
# return
prevtext = self.GetLastSentenceText()
if net.IsChatInsultIn(text):
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHAT_INSULT_STRING)

#Writing Fast System START
if app.GetTime() < self.lasttime + WAITINGTIMEBETWEENMESSAGE:
chat.AppendChat(1, "[WARNING]WOW man calm down your writing too fast!")
#Writing Fast System END

#Spam system START
WAITINGTIME = 60 #in seconds
if self.count == MAXSPAMCOUNT+1:
if app.GetTime() < self.penaltytime:
chat.AppendChat(1, "[PENALTY]Muted 1 minute, time remaining: " + str(int(self.penaltytime - app.GetTime())) + " seconds")
self.count = 0

elif self.count == MAXSPAMCOUNT:
chat.AppendChat(1, "[PENALTY]Muted 1 minute")
self.count = MAXSPAMCOUNT+1
self.penaltytime = app.GetTime()+WAITINGTIME

if len(self.lastSentenceStack) > 1:
if text == prevtext:
self.count = self.count+1
chat.AppendChat(1, "[WARNING]You are spamming!If you persist you will have a penalty. (" + str(self.count) + "/5)")
elif str(self.GetLastSentenceText()) != text:
self.count = 0

#Spam system END

net.SendChatPacket(text, type)
self.lasttime = app.GetTime()

def GetLastSentenceText(self):
lastSentence = self.lastSentenceStack[len(self.lastSentenceStack)-2]
return lastSentence 
I made it to be simple to be costumised so you guys want to change the penalty time or the spam count only need to change this:
WAITINGTIME -> The spam time penalty
MAXSPAMCOUNT -> The number of times players can spam
I also made a simple code so the players need to wait between messages.
WAITINGTIMEBETWEENMESSAGE -> The waiting time between messages
Also add this in __init__ function:
self.count = 0
self.penaltytime = 0
self.lasttime = 0
I hope it was helpfull,
Kind Regards,
- Daan(i dont know how he is called in the forum) - gave me the idea of the waiting time between messages
  • Love 2
Link to comment
  • VIP

That's interesting, but what if your client gets unpacked? This system could be disabled easy. And don't tell me things like "it won't be unpacked". Clients are unpacked easy.

You could try to do this system in C++ for the source. You could add a real chat block.

And one more thing: if you write too fast the server will automatically disconnect you.

Link to comment

This is a system has i said for the ones who dont know how to compile source... I know it can be removed if the client is unpacked, but i dont see any other way to make it without the possibility to be removed.I thing there is already a spam system in c++.

  • Love 1
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

  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.