Anti Spam help
#5

ops, my mistake I used char in ChatSpamTime and bugged it lol try this .
PHP Code:
new SpamCount[MAX_PLAYERS char], ChatSpamTime[MAX_PLAYERS];
AntiSpam(playerid)
{
    new 
msg[145];
    if((
gettime()-ChatSpamTime[playerid]) > || !ChatSpamTime[playerid])
    {
        
SpamCount{playerid} = 1;
        
ChatSpamTime[playerid] = gettime();
    }
    else
    {
        
SpamCount{playerid}++;
        switch(
SpamCount{playerid})
        {
            case 
2:
            {
                
ChatSpamTime[playerid] = gettime(); // <- update the time!
            
}
            case 
3:
            {
                
SendClientMessage(playerid0xFFFFFF"[Anti-Spam]: Warning you are one message away from being muted!");
                
format(msg,sizeof(msg),"[Flood Control] - %s has been warned for flooding",GetName(playerid));
                
ABroadCast(COLOR_ADMIN,msg,1);
                
ChatSpamTime[playerid] = gettime();
            }
            case 
4..99:
            {
                
format(msgsizeof(msg), "[Anti-Spam]: %s has been muted for 5 minutes! (Reason: Spam)"GetName(playerid));
                
SendClientMessageToAll(0xFFFFFFmsg);
                
SendClientMessage(playerid,COLOR_GREEN,"You have received your final warning! You are now muted");
                
PlayerInfo[playerid][muted] = 1;
                print(
msg);
                
SetTimerEx("AutoUnMute",AutoUnmuteTime*60000,false,"i",playerid);
                
ChatSpamTime[playerid] = 0;
                
SpamCount{playerid} = 0;
            }
        }
    }
    return 
1;

also I used { } because I used SpamCount[MAX_PLAYERS char] not SpamCount[MAX_PLAYERS]
Reply


Messages In This Thread
Help Please - by Tass007 - 09.09.2016, 09:46
Re: Anti Spam help - by Tass007 - 10.09.2016, 06:12
Re: Anti Spam help - by jlalt - 10.09.2016, 07:27
Re: Anti Spam help - by Tass007 - 10.09.2016, 07:52
Re: Anti Spam help - by jlalt - 10.09.2016, 08:08
Re: Anti Spam help - by Threshold - 10.09.2016, 08:20

Forum Jump:


Users browsing this thread: 1 Guest(s)