anti spam chat
#9

you have no any reset for this, u're just increasing and increasing, that's a reason why u're getting this.

try this:
at the top of code
PHP Code:
SpamMessages[MAX_PLAYERS],SpamChecker[MAX_PLAYERS]; 
put this code at OnPlayerConnect (or if u have a login system, place at login)
PHP Code:
SpamChecker[playerid] = SetTimerEx("CheckSpam",1000,1,"i",playerid); // u can increase this timer. 
now, put this code at OnPlayerText
PHP Code:
if(PlayerData[playerid][MutedTime] <= 0SpamMessages[playerid] ++;
if(
SpamMessages[playerid] >= 5)
{
    
PlayerData[playerid][Muted] = 1;
    
PlayerData[playerid][MutedTime] += 20;
    new 
str[128]; // blah blah
    
mysql_format(SQLstr,128,"UPDATE `users` SET `Muted`='1' ,`MutedTime`='%d' WHERE `id` = '%d' LIMIT 1",PlayerData[playerid][MutedTime],PlayerData[playerid][ID]); 
    
mysql_tquery(SQLstr""""); 
    
SendClientMessage(playeridCOLOR_GREY"You have been auto-muted for spamming. You will be unmuted in 20 seconds."); 
    return 
0

and now, build the reset function.
PHP Code:
forward CheckSpam(playerid);
public 
CheckSpam(playerid)
{
    if(
SpamMessages[playerid] >= && PlayerData[playerid][MutedTime] <= 0)
    {
        
PlayerData[playerid][Muted] = 1;
        
PlayerData[playerid][MutedTime] += 20;
        new 
str[128]; // blah blah
        
mysql_format(SQLstr,128,"UPDATE `users` SET `Muted`='1' ,`MutedTime`='%d' WHERE `id` = '%d' LIMIT 1",PlayerData[playerid][MutedTime],PlayerData[playerid][ID]); 
        
mysql_tquery(SQLstr""""); 
        
SendClientMessage(playeridCOLOR_GREY"You have been auto-muted for spamming. You will be unmuted in 20 seconds."); 
    }
    else 
SpamMessages[playerid] = 0;
    return 
1;

place this code at OnPlayerDisconnect
PHP Code:
KillTimer(SpamChecker[playerid]); 
Reply


Messages In This Thread
anti spam chat - by PepsiCola23 - 01.02.2018, 20:55
Re: anti spam chat - by OptimusBloodHunter - 01.02.2018, 21:08
Re: anti spam chat - by Mugala - 01.02.2018, 21:09
Re: anti spam chat - by PepsiCola23 - 01.02.2018, 22:02
Re: anti spam chat - by Mugala - 01.02.2018, 22:07
Re: anti spam chat - by PepsiCola23 - 01.02.2018, 22:10
Re: anti spam chat - by Mugala - 01.02.2018, 22:58
Re: anti spam chat - by PepsiCola23 - 01.02.2018, 23:00
Re: anti spam chat - by Mugala - 02.02.2018, 09:53

Forum Jump:


Users browsing this thread: 1 Guest(s)