[SOLVED] Anti Command Spam.
#1

how do I make it so if they are typing a command 4 times+ in a row it wikk kick them Reason command spam. cause on my server you will see something like this.

TELE:BP13 has gone to mostercrash. (/monstercrash)
TELE:BP13 has gone to mostercrash. (/monstercrash)
TELE:BP13 has gone to mostercrash. (/monstercrash)
TELE:BP13 has gone to mostercrash. (/monstercrash)
TELE:BP13 has gone to mostercrash. (/monstercrash)
TELE:BP13 has gone to mostercrash. (/monstercrash)

some people think its (fun?) or something to type it alot of times for no reason. And FYI I searched Anti command spam and nothing of my interest came up. Thanks for helping.
Reply
#2

http://forum.sa-mp.com/index.php?topic=96625.0
This anticheat has message/command anti-spam feature i see. Easy to find.
Reply
#3

I tried that. All it did was make it so that no chat worked at all. I fixed it to make it work. but the command spam did not work
Reply
#4

Strange.. because i tried it now and it works normally.
Reply
#5

maybe suggest another one because it does not work for ME
Reply
#6

Quote:
Originally Posted by [SU
BP13 ]
maybe suggest another one because it does not work for ME
Or maybe you don't know how to use it properly?
Try and search for another one, i won't search for everything you need.
Reply
#7

yes I am aware how to install it. I have even got the creator of it to do it for me. I don not want a full anticheat I only want a stand alone anti-command spam.
Reply
#8

umm help?
Reply
#9

It's pretty simple and can be done in many different ways. While reading your posts I had thought of a pretty cool method. Now for the benefit for everyone else I will create the snippet.

pawn Код:
#define MAX_COMMAND_FREQUENCY 4 //effects how many times a player can type a command without being stopped
new PlayerCmdFrq[MAX_PLAYERS]; //Player Command Frequency
forward UpdateCmdFreq();

public OnPlayerCommandText(playerid,cmdtext[])
{
    PlayerCmdFrq[playerid]++;
    if(PlayerCmdFrq[playerid]>MAX_COMMAND_FREQUENCY)
    {
        SendClientMessage(playerid,0xFF0000FF,"You can't use commands so often.");
        return 1;
    }
    //Then your commands and everything else go here
}
public OnGameModeInit()
{
    SetTimer("UpdateCmdFreq",2000,1);
}
public UpdateCmdFreq()
{
    for(new playerid;playerid<MAX_PLAYERS;playerid++)
    {
      if(PlayerCmdFrq[playerid])PlayerCmdFrq[playerid]--;
    }
}
This will allow a player to do up to 4 but then only let them do 1 per second, which that 1 will roll over to the next second (allowing a build up of 4 again).

Enjoy it!
Reply
#10

i was bout to post mine but i see its already been done. that exsample is like same as mine just has diffrent names
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)