Command Spam
#1

Is There Anything so if like a command or message is been typed more than twice in a row the 3rd time it will say stop spamming but i need it so commands cant be spammed
dose anyone no one please? thanks for helping.
Reply
#2

use junkbuster... it will kick the person.

bad: if an admin uses /slap for a reason 2 times. hell get kicked...
Reply
#3

make a var indexed to every player, for example:
Код:
new SpamCheck[MAX_PLAYERS];
and make a timer, make sure you have a forward for it,
Код:
//OnGameModeInit:
SetTimer("AntiSpam",5000,1); // occurs every 5 seconds
then every time a player types a message, or sends a command add on to your spamcheck var, for example:
Код:
//OnPlayerCommandText:
SpamCheck[playerid] ++;
// and to stop the spam:
if(SpamCheck[playerid] > 5)
{
  SendClientMessage(playerid, COLOR, "DONT SPAM!!!!");
  return 0;
}
and then for chat spam:
Код:
//OnPlayerText:
SpamCheck[playerid] ++;
if(SpamCheck[playerid] > 5)
{
  SendClientMessage(playerid, COLOR, "DONT SPAM!!!!");
  return 0;
}
and the public function for the timer:
Код:
public AntiSpam()
{
  for(new i=0; i<MAX_PLAYERS; i++)
  {
    SpamCheck[playerid] --;
  }
}
as you see the timer runs every 5 seconds and you will get "DONT SPAM!!!!" if you send a command / msg more than 5 times, so thats 1 command/msg a second you will be able to send without getting do not spam.

you can of curse change it to how you want.
Reply
#4

Quote:
Originally Posted by <__Ǝthan__>
make a var indexed to every player, for example:
Код:
new SpamCheck[MAX_PLAYERS];
and make a timer, make sure you have a forward for it,
Код:
//OnGameModeInit:
SetTimer("AntiSpam",5000,1); // occurs every 5 seconds
then every time a player types a message, or sends a command add on to your spamcheck var, for example:
Код:
//OnPlayerCommandText:
SpamCheck[playerid] ++;
// and to stop the spam:
if(SpamCheck[playerid] > 5)
{
 SendClientMessage(playerid, COLOR, "DONT SPAM!!!!");
 return 0;
}
and then for chat spam:
Код:
//OnPlayerText:
SpamCheck[playerid] ++;
if(SpamCheck[playerid] > 5)
{
 SendClientMessage(playerid, COLOR, "DONT SPAM!!!!");
 return 0;
}
and the public function for the timer:
Код:
public AntiSpam()
{
 for(new i=0; i<MAX_PLAYERS; i++)
 {
   SpamCheck[playerid] --;
 }
}
as you see the timer runs every 5 seconds and you will get "DONT SPAM!!!!" if you send a command / msg more than 5 times, so thats 1 command/msg a second you will be able to send without getting do not spam.

you can of curse change it to how you want.
dosent work when i add it.? ill try another way editing your idear and let you no how i get on thanks os much mate.
Reply
#5

yes, you will have to edit it to fit your script, you cant just take an example i gave you and throw it in an expect it to work, you gotta do some work to, hope you get it working!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)