24.02.2012, 00:48
(
Последний раз редактировалось RyDeR`; 28.06.2012 в 12:58.
)
Introduction
I saw JernejL's topic about blocking flood bots and read this comment:
So I decided to quickly create a simple include which makes it very easy to manage everything.
Functions
We have only one callback:
And two defines:
Your custom values will be applied once you set these values before including it.
Example
The following example will IP-Ban the player/bot that joined more than 2 times in a time span of less then 8 seconds:
You can customize it like however you want it.
Download
FloodControl.inc
Changelog
I saw JernejL's topic about blocking flood bots and read this comment:
Quote:
Anyways, i post snippets.. i'm hoping someone of you will turn this into a filterscript that reads a flood limit number off a cfg file and enables people to easily set up flood control.
|
Functions
We have only one callback:
pawn Код:
forward OnPlayerFloodControl(playerid, iCount, iTimeSpan);
pawn Код:
#if !defined MAX_JOIN_LOGS
#define MAX_JOIN_LOGS (50)
#endif
pawn Код:
#if !defined MAX_THRESHOLD
#define MAX_THRESHOLD (8000) // The amount of time in which all joins are valid and counted
#endif
Example
The following example will IP-Ban the player/bot that joined more than 2 times in a time span of less then 8 seconds:
pawn Код:
#include <a_samp>
#include <FloodControl>
public OnPlayerFloodControl(playerid, iCount, iTimeSpan) {
if(iCount > 2 && iTimeSpan < 8000) {
Ban(playerid);
}
}
public OnPlayerConnect(playerid) {
return 1;
}
Download
FloodControl.inc
Changelog
- 24/02/2012:
- Initial release
- 28/06/2012:
- Fixed an important bug where the timespan gets messed up if you first join, wait a bit, and then spam.
- Fixed the hooking method.
- Added:
pawn Код:#if !defined MAX_THRESHOLD
#define MAX_THRESHOLD (8000) // The amount of time in which all joins are valid and counted
#endif