public OnPlayerText(playerid, text[]) {
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
}
public OnPlayerText(playerid, text[]) {
static
p_flood[MAX_PLAYERS]
;
new
time = tickcount()
;
if (p_flood[playerid] >= time) {
p_flood[playerid] = time + 2000;
new
msg[128]
;
format(msg, sizeof(msg), "Your chat has offned for flood. Wait on %d seconds", (p_flood[playerid]-time) / 1000);
SendClientMessage(playerid, -1, msg);
//Kick(playerid);
return false; // Chat off
} else {
p_flood[playerid] = time + 2000; // Block on 2 seconds
}
return true; // Chat on
}
|
>>>>>>>>>>>>>>!$#@!DO NOT FLOOD!$#@!<<<<<<<<<<<<<< >>>>>>>>>>>>>>!$#@!DO NOT FLOOD!$#@!<<<<<<<<<<<<<< >>>>>>>>>>>>>>!$#@!DO NOT FLOOD!$#@!<<<<<<<<<<<<<< >>>>>>>>>>>>>>!$#@!DO NOT FLOOD!$#@!<<<<<<<<<<<<<< >>>>>>>>>>>>>>!$#@!DO NOT FLOOD!$#@!<<<<<<<<<<<<<< |
|
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 |
forward KickPlayer(playerid);
public KickPlayer(playerid) {
return Kick(playerid);
}
public OnPlayerText(playerid, text[]) {
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(playerid, name, sizeof(name));
format(msg, sizeof(msg), "Server: %s(%d) has kicked for flood", name, playerid);
SendClientMessageToAll(0xFF0000FF, msg);
SetTimerEx("KickPlayer", 200, 0, "i", playerid); // Delay for messange
return true;
}
p_flood[playerid][0] = time + 2000;
new
msg[128]
;
format(msg, sizeof(msg), "Your chat has offned for flood. Wait on %d seconds", (p_flood[playerid][0]-time) / 1000);
SendClientMessage(playerid, -1, msg);
return false; // Chat off
} else {
p_flood[playerid][0] = time + 2000; // Block on 2 seconds
}
return true; // Chat on
}