Author Topic: Flood Protection  (Read 1202 times)

I think so, since the value is 1 for 10 seconds.
So, it activates their flood protection?

this seems pointless imo...

maybe if i knew what you were actually trying to do here...

So, it activates their flood protection?
The echo proved that it has values, it also proved that 1 means the client is under flood protection, you could try this yourself. After finding that it has values, I tried to use it in my script which failed. Basically, I wanted it to continue the code if the client was not under flood protection, instead it resulted in giving me two flood warnings and continued running the code:
Code: [Select]
package TEST
{
     function serverCmdMessageSent(%client, %text)
     {
          if(spamAlert(%client) == 0)
          {
               //Code goes here
          }
          parent::serverCmdMessageSent(%client, %text);
     }
};
activatePackage(TEST);
The echo said yes, it does activate their flood protection. It doesn't seem that way in the code, unless I've made a mistake in it? I need some clarification on this, this is how I'm presuming it works.


this seems pointless imo...

maybe if i knew what you were actually trying to do here...
Maybe re-reading the posts will help, I've left enough information on what I am trying to do.
« Last Edit: July 24, 2010, 06:20:56 PM by General »


Whatever you do, don't clear the spamAlert function. It crashes the game if anyone talks...

Just remake the servercmdmessagesent and create your own flood protection, so you can give variables and what not; that's all i can say, since i have no clue what the overall attempt here is.

Just remake the servercmdmessagesent and create your own flood protection, so you can give variables and what not; that's all i can say, since i have no clue what the overall attempt here is.

^ Bad idea. There's tons of protection in the command. Rewriting it breaks the protection, allowing tons of bad stuff.

that's all i can say, since i have no clue what the overall attempt here is.
It seems I haven't made myself clear enough?

My overall attempt is to make a script which checks that the client is not under flood protection before continuing with the main code, for example: If somebody says "What are the rules?" The rules will appear in the message hud, but if the client is under flood protection it will ignore it.

I can't possibly make myself clearer?

Quark and I recently found out another way we could find if the client is under flood protection, and it worked!
Code: [Select]
package TEST
{
function serverCmdMessageSent(%client, %text)
{
%time = getSimTime();
        %spamTime = %client.spamProtectStart;
        if(%time - %spamTime < 10000 || %text $= %client.lastMsgSent && !%client.isAdmin)
{
cancel(%client.lastMsgSentSchedule);
%client.lastMsgSentSchedule = schedule(15000,0,eval,%client @ ".lastMsgSent = '';");
}
else
        {
//code goes here
}
%client.lastMsgSent = %text;
parent::serverCmdMessageSent(%client, %text);
}
};
activatepackage(TEST);

Reguardless, thank you all for your help.