0 Members and 1 Guest are viewing this topic.
function xsplit(const source: string; const delimiter: string):TStringArray;vari,x,d:integer;s:string;begind:=length(delimiter);x:=0;i:=1;SetArrayLength(Result,1);while(i<=length(source)) do begins:=Copy(source,i,d); if(s=delimiter) then begin inc(i,d); inc(x,1); SetArrayLength(result,x+1); end else begin result[x]:= result[x]+Copy(s,1,1); inc(i,1); end;end;end;
var line : array[0..255] of record whole: string; parts: array[0..2] of string; end; procedure AppOnIdle(Ticks: integer);varlines: TStringArray;i: byte;j: byte;beginif Ticks mod (60 * 5) = 0 then begin lines := XSplit(ReadFile('banned.txt'),chr(13) + chr(10)); if ContainsString(lines[0],'.') then begin for i:=0 to GetArrayLength(lines) - 2 do line[i].whole:=trim(lines[i]); for j:=0 to GetArrayLength(lines) - 2 do begin line[j].parts[0]:=GetPiece(line[j].whole,':',0); line[j].parts[1]:=GetPiece(line[j].whole,':',1); line[j].parts[2]:=GetPiece(line[j].whole,':',2); end; end; end;end;function OnCommand(ID: Byte; Text: string): boolean;vari: byte;bantime: integer;lines: TStringArray;beginif Text = '/banlist' thenbegin lines := XSplit(ReadFile('banned.txt'),chr(13) + chr(10)); if ContainsString(lines[0],'.') then begin WriteConsole(ID,'*** BAN LIST ***',$FFFF0000); for i:=0 to getarraylength(lines) - 2 do begin bantime:=strtoint(line[i].parts[1]); bantime:=bantime/3600; WriteConsole(ID,inttostr(i)+'. IP: '+line[i].parts[0]+' Time: '+inttostr(bantime)+' minutes. Info: '+line[i].parts[2],$FFff7e00); end; end;end;if GetPiece(Text,' ',0) = '/ub' thenbegini:=strtoint(GetPiece(Text,' ',1));Command('/unban '+line[i].parts[0]);end;Result := false; // Return true if you want to ignore the command typed.end;