Command Spam
#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


Messages In This Thread
Command Spam - by [top_Shoter] - 20.07.2009, 04:12
Re: Command Spam - by lilstuh - 20.07.2009, 06:26
Re: Command Spam - by StrickenKid - 20.07.2009, 06:40
Re: Command Spam - by [top_Shoter] - 20.07.2009, 07:02
Re: Command Spam - by StrickenKid - 20.07.2009, 07:13

Forum Jump:


Users browsing this thread: 1 Guest(s)