I just acknowledged that there are random invisible chars that mess everything up. I'll post the corrected code in some minutes :3
EDIT: This should be working now..
const
ClBad = $FFFF44;
ClGood = $EE00FF;
Type
Stats = Record
LongTime: Boolean;
TSec,Tmin,BTSec,BTMin: Integer;
end;
var
Player: Array[1..32] of Stats;
LongestTime: Array[1..2] of Integer;
Procedure ResetStats(ID:Byte);
begin
Player[ID].LongTime := false;
end;
Procedure CheckTime(ID:Byte);
begin
if Player[ID].BTMin > LongestTime[1] then begin
LongestTime[1] := Player[ID].BTMin;
LongestTime[2] := Player[ID].BTSec;
Player[ID].LongTime := true;
WriteConsole(0,IDToName(ID) + ' beats the record! His surviving time is ' + inttostr(Player[ID].BTMin) + ' minutes and ' + inttostr(Player[ID].BTSec) + ' seconds!', ClGood);
end else begin
if Player[ID].BTMin = LongestTime[1] then
if Player[ID].BTSec > LongestTime[2] then begin
LongestTime[1] := Player[ID].BTMin;
LongestTime[2] := Player[ID].BTSec;
Player[ID].LongTime := true;
WriteConsole(0,IDToName(ID) + ' beats the record! His surviving time is ' + inttostr(Player[ID].BTMin) + ' minutes and ' + inttostr(Player[ID].BTSec) + ' seconds!', ClGood);
end;
end;
end;
Procedure OnJoinGame(ID,Team:Byte);
begin
ResetStats(ID);
end;
Procedure AppOnIdle(Ticks: integer);
var
i:Byte;
begin
for i:= 1 to 32 do if (GetPlayerStat(i,'Active') = true) AND (GetPlayerStat(i,'Alive') = true) then begin
if GetPlayerStat(i,'Human') = true then begin
TSec[i]:= TSec[i] + 1;
if TSec[i] = 60 then begin
TMin[i]:= TMin[i] + 1;
TSec[i]:= 0;
end;
end else begin
if TSec[i] > 0 then BTSec[i] := TSec[i];
TSec[i] := 0;
if TMin[i] > 0 then BTMin[i]:= TMin[i];
TMin[i] := 0;
CheckTime(i);
end;
end;
end;