SA-MP Forums Archive
Anti command spam HELP REP + - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Anti command spam HELP REP + (/showthread.php?tid=567361)



Anti command spam HELP REP + - Mijata - 13.03.2015

how to add here anti command spam?

Код:
	if(AntiSpam == 1 && pInfo[playerid][Muted] == 0)
	{
           GetPVarString(playerid, "ChatMsg",CTMSG,128);
           if(!strcmp(CTMSG, text,  false))
           {
              pInfo[playerid][SpamWarns]++;
              if(pInfo[playerid][SpamWarns] < MAX_SPAM_WARNS)SendClientMessage(playerid,red,"WARNING: Do not repeat or you will be muted!");
              if(pInfo[playerid][SpamWarns] >= MAX_SPAM_WARNS)
              {
		          format(Jstring,sizeof(Jstring),"%s(%d) has been automatically muted for %d seconds | REASON: \"Spam\"",GetName(playerid),playerid,AUTO_MUTE_TIME);
				  SendClientMessageToAll(red, Jstring);
				  pInfo[playerid][Muted] = 1;
				  SetTimerEx("UnmutePlayer",AUTO_MUTE_TIME*1000,false,"d",playerid);
				  return 0;
			  }
		   }
		   else pInfo[playerid][SpamWarns] = 0;
		   SetPVarString(playerid,"ChatMsg",text);
	}



Re: Anti command spam HELP REP + - Mijata - 13.03.2015

bump


Re: Anti command spam HELP REP + - JaKe Elite - 13.03.2015

What is your main purpose exactly? Be specific.


Re: Anti command spam HELP REP + - Mijata - 13.03.2015

i need anti command spam system beacuse it can create lag in server when idiot come to server and spam commands


Re: Anti command spam HELP REP + - HydraHumza - 13.03.2015

PHP код:
if(ServerInfo[AntiSpam] == &&  !IsPlayerAdmin(playerid)) )
    {
        if(
PlayerInfo[playerid][SpamCount] == 0PlayerInfo[playerid][SpamTime] = TimeStamp();
        
PlayerInfo[playerid][SpamCount]++;
        if(
TimeStamp() - PlayerInfo[playerid][SpamTime] > SPAM_TIMELIMIT) { // Its OK your messages were far enough apart
            
PlayerInfo[playerid][SpamCount] = 0;
            
PlayerInfo[playerid][SpamTime] = TimeStamp();
        }
        else if(
PlayerInfo[playerid][SpamCount] == SPAM_MAX_MSGS) {
            new 
string[64]; format(string,sizeof(string),"Server has kicked %s (Flood/Spam Protection)"PlayerName2(playerid));
            
SendClientMessageToAll(red,string); print(string);
            
SaveToFile("KickLog",string);
            
Kick(playerid);
        }
        else if(
PlayerInfo[playerid][SpamCount] == SPAM_MAX_MSGS-1) {
            
SendClientMessage(playerid,red,"Server: Anti Spam Warning! Next is a kick.");
            return 
0;
        }
    } 
Try This