Anti Chat Flood?
#1

Ok, i made simple anti swear - anti KILLBOARD flood, but i need anti chat flood, idk how it can be done, i saw some tutorials in ****** and forum search but useless D:, i cannot understand anything because its old lol, like 3-4years so
if someone can gimme an idea how it can be done, or a tutorial which can explain xP
Reply
#2

Anti-flood chat:

PHP код:
public OnPlayerText(playeridtext[]) {
      static
           
p_flood[MAX_PLAYERS]
      ;
      new
           
time tickcount()
      ;
      if (
p_flood[playerid] > time) {
             
SendClientMessage(playerid, -1"You bad flooder, get ouit!");
             
//Kick(playerid);
             
return false// Chat off
      
} else {
             
p_flood[playerid] = time 3000// Block on 3 seconds
      
}
      return 
true// Chat on

extended example:

PHP код:
public OnPlayerText(playeridtext[]) {
      static
           
p_flood[MAX_PLAYERS]
      ;
      new
           
time tickcount()
      ;
      if (
p_flood[playerid] >= time) {
             
p_flood[playerid] = time 2000;
             new 
                   
msg[128]
             ;
             
format(msgsizeof(msg), "Your chat has offned for flood. Wait on %d seconds", (p_flood[playerid]-time) / 1000);
             
SendClientMessage(playerid, -1msg);
             
//Kick(playerid);
             
return false// Chat off
      
} else {
             
p_flood[playerid] = time 2000// Block on 2 seconds
      
}
      return 
true// Chat on

Reply
#3

i need smth like, if player said those flood messages which used by most of cheats smth like:
Quote:

>>>>>>>>>>>>>>!$#@!DO NOT FLOOD!$#@!<<<<<<<<<<<<<<
>>>>>>>>>>>>>>!$#@!DO NOT FLOOD!$#@!<<<<<<<<<<<<<<
>>>>>>>>>>>>>>!$#@!DO NOT FLOOD!$#@!<<<<<<<<<<<<<<
>>>>>>>>>>>>>>!$#@!DO NOT FLOOD!$#@!<<<<<<<<<<<<<<
>>>>>>>>>>>>>>!$#@!DO NOT FLOOD!$#@!<<<<<<<<<<<<<<

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
Reply
#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


Forum Jump:


Users browsing this thread: 2 Guest(s)