0 Members and 1 Guest are viewing this topic.

const ADMIN_UPTIME_ON=1; //turns off/on /uptime script PLAYER_UPTIME_ON=1; //turns off/on !uptime script 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 minutesvar up: integer; flooderID: array[1..32] of integer; i: integer;procedure ActivateServer();begin up:=0; for i:= 1 to 32 do flooderID[i]:=0; //are they initialized with zeros anyway?end;procedure AppOnIdle(Ticks: integer);begin up:=up+1; 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;function formatTime():string;var d,h,m,s: integer;begin d:= up/86400; h:= up/3600 mod 24; m:= up/60 mod 60; s:= up mod 60; if((d=0) and (h=0)) then begin result:=inttostr(m)+'m:'+inttostr(s)+'s'; end else if d=0 then begin result:=inttostr(h)+'h:'+inttostr(m)+'m:'+inttostr(s)+'s'; end else result:=inttostr(d)+'d:'+inttostr(h)+'h:'+inttostr(m)+'m:'+inttostr(s)+'s';end;procedure OnPlayerSpeak(Name,Text: string);beginif((Text='!uptime')and(PLAYER_UPTIME_ON=1)) then begin saytoplayer(NametoID(Name),'server is running for: '+formatTime());end;end;procedure OnCommand(ID: integer;Text: string);begin if((Text='/uptime')and(ADMIN_UPTIME_ON=1)) then begin saytoplayer(ID,'server is running for: '+formatTime()); end;end;procedure OnJoinTeam(IP, Nickname: string;Team: byte);begin flooderID[NameToID(Nickname)]:= flooderID[NameToID(Nickname)]+1; //where's my i++ ;pend;