Author Topic: joinFloodTrace  (Read 5195 times)

0 Members and 2 Guests are viewing this topic.

Offline cooz

  • Soldier
  • **
  • Posts: 187
  • BANNED
joinFloodTrace
« on: November 07, 2006, 05:05:00 am »
Script Name: joinFloodTrace
Script Description: Script which will kick and ban player who joins and leaves game rapidly
Author: cooz
Core Version: 2.5.2

Code: [Select]
const
  REDUCE = 6;    //second after flooders stats are updated, higher value - bans slower
  LIMIT = 3;       //amount of game join/leaves till ban, lower value - bans faster
  BANTIME = 60; //in minutes

var
  flooderID: array[1..32] of integer;
  i: integer;

procedure ActivateServer();
begin
  for i:= 1 to 32 do flooderID[i]:=0; //are they initialized with zeros anyway?
end;

procedure OnJoinTeam(IP, Nickname: string;Team: byte);
begin
  flooderID[NameToID(Nickname)]:= flooderID[NameToID(Nickname)]+1; //where's my i++ ;p
end;

procedure AppOnIdle(Ticks: integer);
begin
  for i:=1 to 32 do begin
    if flooderID[i]>LIMIT then begin
      BanPlayer(i,BANTIME);
      flooderID[i]:=0;
    end;
  end;

  if Ticks mod (60*REDUCE) = 0 then begin
    for i:=1 to 32 do if flooderID[i]>0 then flooderID[i]:= flooderID[i]-1;
  end;
end;

« Last Edit: November 29, 2006, 04:04:10 pm by cooz »
Dead man! Dead man walking! We got a dead man walking here! Banned man crawling more like