How to make this ? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to make this ? (
/showthread.php?tid=579114)
How to make this ? -
VenomMancer - 24.06.2015
Stop chat spam attack from bot?
who know how to stop it ?
#sorryformybadenglish
Re: How to make this ? -
Hessu - 24.06.2015
Look this:
https://sampforum.blast.hk/showthread.php?tid=578776
Re : How to make this ? -
KillerDVX - 24.06.2015
Here's an anti Bot created by Amit_B, it shoud helps.
Pastebin
KillerDVX,
Re: How to make this ? -
VenomMancer - 24.06.2015
Quote:
Originally Posted by Hessu
|
Not.
I mean 1 bot join in server then spam/flooding on chat.
How to stop it ?
Re : How to make this ? -
KillerDVX - 24.06.2015
Kick it ? Too easy ^^"
Re: Re : How to make this ? -
VenomMancer - 24.06.2015
Quote:
Originally Posted by KillerDVX
Kick it ? Too easy ^^"
|
It will stop for BOOT flood join in server.
My problem is:
Just have 1 bot join then he flooding/spam chat in my server.
its make so very lag.
How to stop it ?
Re: How to make this ? -
liquor - 24.06.2015
pawn Код:
// TOP OF SCRIPT
new chatcount[MAX_PLAYERS];
// Inside OnPlayerConnect
public OnPlayerConnect(playerid)
{
SetTimerEx("antispam", 2000, 1, "i", playerid);
// The rest of your code
return 1;
}
// Somewhere
forward antispam(playerid);
public antispam(playerid)
{
if(chatcount[playerid] > 3) // If player sent more than 3 messages in 2 seconds... probably a bot/keybind
{
return Kick(playerid); // Kick player if spamming, now you can do anything to him.
}
else
{
chatcount[playerid] = 0; // If he didn't spam, reset count.
}
return 1;
}
// In your chat, e.g. OnPlayerText
public OnPlayerText(playerid, text[])
{
chatcount[playerid]++;
// THE REST OF YOUR CODE
return 1;
}
Of course you can change the interval of the timer, or the number of messages required to count as spam.
Re: How to make this ? -
Inn0cent - 24.06.2015
Код:
public OnPlayerText(playerid, text[])//This Callback is called as soon as a player types smth. into the chat.
{
SpamCount[playerid]++;
if(SpamCount[playerid] == 1)
{
spamtime[playerid][0] = gettime();
}
if(SpamCount[playerid] == 2)
{
if(gettime()-spamtime[playerid][0] < 2)//We will check if the player send the next message within two seconds. And if yes give him a warning or something.
{
Give a warning.
spamtime[playerid][1] = gettime();
} else { SpamCount[playerid] = 0; }
}
if(SpamCount[playerid] == 3)
{
if(gettime()-spamtime[playerid][1] < 3)//We will check if the player send the next message within 3 seconds. And if yes give him a warning or something.
{
Kick him.
SpamCount[playerid] = 0;
} else { SpamCount[playerid] = 0; }
}
}
Re: How to make this ? -
VenomMancer - 24.06.2015
Already make anti chat spam.
But why did not works ?
PHP код:
public OnPlayerText(playerid, text[])
{
//==============================================================================
// Flood/Spam Protection
//==============================================================================
if(ServerInfo[AntiSpam] == 1 && (pInfo[playerid][Admin] == 0 && !IsPlayerAdmin(playerid)))
{
if(pInfo[playerid][SpamCount] == 0) pInfo[playerid][SpamTime] = TimeStamp();
pInfo[playerid][SpamCount]++;
if(TimeStamp() - pInfo[playerid][SpamTime] > SPAM_TIMELIMIT) { // Its OK your messages were far enough apart
pInfo[playerid][SpamCount] = 0;
pInfo[playerid][SpamTime] = TimeStamp();
}
else if(pInfo[playerid][SpamCount] == SPAM_MAX_MSGS) {
new string[250];
format(string,sizeof(string),"{FF0000}|- Player %s (Id:%d) telah otomatis di Kick. | Alasan: Flood/Spam Protection -|", GetName(playerid),playerid);
if(GetPVarInt(playerid,"Kick") != 1)
{
SendClientMessageToAll(grey,string);
SetPVarInt(playerid,"Kick",1);
}
SaveIn("KickLog",string);
pKick(playerid);
}
else if(pInfo[playerid][SpamCount] == SPAM_MAX_MSGS-1)
{
SendClientMessage(playerid,Red,"ATTENTION: Anti Spam! Selanjutnya = Kick!");
SMT(playerid,"~r~~h~WARNING: ~w~Stop spam 1x lagi anda chat = kick dari server!");
return 0;
}
}
return 0;
}