PDA

View Full Version : Anti command spam HELP REP +


Mijata
13/03/2015, 01:37 PM
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);
}

Mijata
13/03/2015, 02:39 PM
bump

JaKe Elite
13/03/2015, 02:46 PM
What is your main purpose exactly? Be specific.

Mijata
13/03/2015, 02:56 PM
i need anti command spam system beacuse it can create lag in server when idiot come to server and spam commands

HydraHumza
13/03/2015, 03:32 PM
if(ServerInfo[AntiSpam] == 1 && !IsPlayerAdmin(playerid)) )
{
if(PlayerInfo[playerid][SpamCount] == 0) PlayerInfo[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