[Tutorial] y_flooding
#1

This has been part of YSI for many years, but I don't remember ever documenting it.

There is just one function:

Code:
SetMaxConnections(max, action);
Both the parameters are optional, calling it with no parameters:

Code:
SetMaxConnections();
Removes all limits, and lets as many people as they like connect from the same IP.

The first parameter limits the number of connections from one IP:

Code:
SetMaxConnections(2);
That will let just two people (clients) connect at once on one IP.

The second parameter tells the system what to do if any extra clients connect from that IP. The default is "BLOCK" - any further connections will be refused. There are several other options:
  • e_FLOOD_ACTION_BLOCK - Kick the latest player on this IP (don't let them connect)
  • e_FLOOD_ACTION_KICK - Kick all players on this IP.
  • e_FLOOD_ACTION_BAN - Ban the IP and have the players time out.
  • e_FLOOD_ACTION_FBAN - Ban the IP and kick all the players instantly.
  • e_FLOOD_ACTION_GHOST - Silently force all players on the IP to reconnect.
  • e_FLOOD_ACTION_OTHER - Call the "OnFloodLimitExcceded" callback.
The last one calls a callback, AND provides an iterator to list all the players on that IP:

Code:
public OnFloodLimitExcceded(ip[16], count)
{
    foreach (new i : FloodingPlayer)
    {
        SendClientMessage(i, 0xFF0000AA, "There are too many of you on this IP!");
        Kick(i);
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)