Anti Chat Flood?
#4

Quote:
Originally Posted by karemmahmed22
Посмотреть сообщение
i need smth like, if player said those flood messages which used by most of cheats smth like:

If he says this 5times i mean, repeated same line but with changes to avoid the anti spam, so he gets kicked, idk how to do it :S
Code:

PHP код:

forward KickPlayer
(playerid);
public 
KickPlayer(playerid) {
     return 
Kick(playerid);
}
public 
OnPlayerText(playeridtext[]) {
      static
           
p_flood[MAX_PLAYERS][2]
      ;
      new
           
time tickcount()
      ;
      if (
p_flood[playerid][0] > time) {
             
p_flood[playerid][1]++;
             if (
p_flood[playerid][1] >= 5) {
                  
p_flood[playerid][0] = 0;
                  
p_flood[playerid][1] = 0;
                  new
                      
name[MAX_PLAYER_NAME]
                  ;
                  
GetPlayerName(playeridnamesizeof(name));
                  
format(msgsizeof(msg), "Server: %s(%d) has kicked for flood"nameplayerid);
                  
SendClientMessageToAll(0xFF0000FFmsg);
                  
SetTimerEx("KickPlayer"2000"i"playerid); // Delay for messange
                  
return true;
             }
             
p_flood[playerid][0] = time 2000;
             new 
                   
msg[128]
             ;
             
format(msgsizeof(msg), "Your chat has offned for flood. Wait on %d seconds", (p_flood[playerid][0]-time) / 1000);
             
SendClientMessage(playerid, -1msg);
             return 
false// Chat off
      
} else {
             
p_flood[playerid][0] = time 2000// Block on 2 seconds
      
}
      return 
true// Chat on

Reply


Messages In This Thread
Anti Chat Flood? - by karemmahmed22 - 05.09.2015, 17:46
Re: Anti Chat Flood? - by Logofero - 05.09.2015, 17:54
Re: Anti Chat Flood? - by karemmahmed22 - 05.09.2015, 19:39
Re: Anti Chat Flood? - by Logofero - 05.09.2015, 21:03

Forum Jump:


Users browsing this thread: 1 Guest(s)