Anti command spam HELP REP +
#1

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);
	}
Reply
#2

bump
Reply
#3

What is your main purpose exactly? Be specific.
Reply
#4

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)