Posts: 303
Threads: 95
Joined: Mar 2012
Reputation:
0
Hello!
I want a script like if a player type a text for eg: hi all
Then if he type the same text 1 more time then it should not come.
If should send a message that " You cannot type the same text 1 more time"
Can anyone help me??
Posts: 244
Threads: 2
Joined: Apr 2012
Reputation:
0
Make a new variable "new AntiSpamChat[MAX_PLAYERS];", Whenever someone says something, increase that value using "AntiSpamChat[playerid]+1;", Add a check if he has said something in that time.
Add a timer that resets every X seconds (e.g. 5 messages per 5 seconds) and if the messages are above 5 simply return 0 and send the player a client message to stop spamming.
Posts: 303
Threads: 95
Joined: Mar 2012
Reputation:
0
Can you post the code please?
Posts: 2,593
Threads: 34
Joined: Dec 2007
pawn Код:
static pText[MAX_PLAYERS][128];
if(!strcmp(pText[playerid],text,true)) return SendClientMEssage(playerid,-1,"You cannot type the same text 1 more time.");
strcat((pText[playerid][0]='\0',pText[playerid]),text,128);
All in OnPlayerText public
Posts: 303
Threads: 95
Joined: Mar 2012
Reputation:
0
Yes i have tried but when i type something it shows "You cannot type the same text 1 more time." to me and the text is shown in the chat.I can type the same thing again and again.