0 Members and 1 Guest are viewing this topic.
var UnBanInProgress: boolean;Type tBanRow = Record BannedIPOrHWID, BanReason: string;end;//THX for DorkeyDear & CurryWurstfunction Explode(Source: string; const Delimiter: string): array of string;var Position, DelLength, ResLength: integer;begin DelLength := Length(Delimiter); Source := Source + Delimiter; repeat Position := Pos(Delimiter, Source); SetArrayLength(Result, ResLength + 1); Result[ResLength] := Copy(Source, 1, Position - 1); ResLength := ResLength + 1; Delete(Source, 1, Position + DelLength - 1); until (Position = 0); SetArrayLength(Result, ResLength - 1);end;function CheckReadFromFile(name: string): string;begin Result:=''; if FileExists(name) then begin Result:=ReadFile(name); Result:=Copy(Result, 0, Length(Result)-2); end;end;procedure UnBan(FileName: string);var i, ABanRowsLength: integer; AInput: array of string; BanRows: array of tBanRow;begin if CheckReadFromFile(FileName)<>'' then begin AInput:=Explode(CheckReadFromFile(FileName), chr(13)+chr(10)); SetArrayLength(BanRows, 0); for i:=0 to GetArrayLength(AInput)-1 do begin ABanRowsLength:=GetArrayLength(BanRows); SetArrayLength(BanRows, ABanRowsLength+1); BanRows[i].BannedIPOrHWID:=GetPiece(AInput[i], ':', 0); BanRows[i].BanReason:=GetPiece(AInput[i], ':', 2); end; for i:=0 to GetArrayLength(BanRows)-1 do begin if BanRows[i].BanReason='Vote Kicked by Server' then begin Command(iif(FileName='banned.txt', '/unban ', '/unbanhw ')+BanRows[i].BannedIPOrHWID); end; end; WriteLn('<'+ScriptName+'> Procedure unban for '+FileName+' done.'); end else begin WriteLn('<'+ScriptName+'> Nothing to do with '+FileName); end;end;function UnBanTime(): boolean;begin Result:=iif((FormatDate('h am/pm')='1 am'), TRUE, FALSE);end;procedure AppOnIdle(Ticks: integer);begin if Ticks mod (60*60*60) = 0 then begin if UnBanTime() then UnBanInProgress:=TRUE; end; if UnBanInProgress then begin if Ticks mod (60*60*5) = 0 then begin if NumPlayers=0 then begin UnBan('banned.txt'); UnBan('bannedhw.txt'); UnBanInProgress:=FALSE; end; end; end; end;function OnCommand(ID: byte; Text: string): boolean;begin if Text='/serverunban' then begin UnBan('banned.txt'); UnBan('bannedhw.txt'); end; Result:=FALSE;end;
My question is - why there is sometimes 5 minutes ban, sometimes 60 min and sometimes there is permanent ban? Why there is such possibility to get permanent ban after vote-kicking ?!