20.07.2009, 06:40
make a var indexed to every player, for example:
and make a timer, make sure you have a forward for it,
then every time a player types a message, or sends a command add on to your spamcheck var, for example:
and then for chat spam:
and the public function for the timer:
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.
Код:
new SpamCheck[MAX_PLAYERS];
Код:
//OnGameModeInit: SetTimer("AntiSpam",5000,1); // occurs every 5 seconds
Код:
//OnPlayerCommandText: SpamCheck[playerid] ++; // and to stop the spam: if(SpamCheck[playerid] > 5) { SendClientMessage(playerid, COLOR, "DONT SPAM!!!!"); return 0; }
Код:
//OnPlayerText: SpamCheck[playerid] ++; if(SpamCheck[playerid] > 5) { SendClientMessage(playerid, COLOR, "DONT SPAM!!!!"); return 0; }
Код:
public AntiSpam() { for(new i=0; i<MAX_PLAYERS; i++) { SpamCheck[playerid] --; } }
you can of curse change it to how you want.