Advertisement
Guest User

ZitroFUN-Heavy

a guest
Dec 29th, 2014
407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 136.70 KB | None | 0 0
  1. const
  2.     DEATHMATCH = 0;     // Compatible ✔
  3.     POINTMATCH = 1;    // Compatible ✔
  4.     TEAMMATCH = 2;    // Compatible ✔
  5.     CTF = 3;         // Compatible ✔
  6.     RAMBO = 4;      // Compatible ✔
  7.     INF = 5;       // Compatible ✔
  8.     HTF = 6;      // Compatible ✔
  9.     ZitroVersion = 'v1.0.0 - Heavy'; //Code: 1807`974 end = 2257 Build=1.7.0.94
  10.     CRLF = #13#10;
  11.     rank_store = 10;
  12.     AssistMinimumDamagePercent = 65; // Damage minimum to get assist
  13.     CooldownTimer = 0;              // Time from injury after which you can not already get assist
  14.     TimeCon = 30;                  // Time from injury after which you can not get savior
  15.     precision = 6;                // Precision calculation powers for point ELO-Point system
  16. type
  17.     TRank = record                                      //      ___                       ___           ___           ___           ___           ___           ___
  18.             Points: integer;                            //     /\  \          ___        /\  \         /\  \         /\  \         /\  \         /\__\         /\__\
  19.             Name: string;                               //     \:\  \        /\  \       \:\  \       /::\  \       /::\  \       /::\  \       /:/  /        /::|  |
  20. end;                                                    //      \:\  \       \:\  \       \:\  \     /:/\:\  \     /:/\:\  \     /:/\:\  \     /:/  /        /:|:|  |
  21. type                                                    //       \:\  \      /::\__\      /::\  \   /::\~\:\  \   /:/  \:\  \   /::\~\:\  \   /:/  /  ___   /:/|:|  |__
  22.     TMapRanks = record                                  // _______\:\__\  __/:/\/__/     /:/\:\__\ /:/\:\ \:\__\ /:/__/ \:\__\ /:/\:\ \:\__\ /:/__/  /\__\ /:/ |:| /\__\
  23.             Played: integer;                            // \::::::::/__/ /\/:/  /       /:/  \/__/ \/_|::\/:/  / \:\  \ /:/  / \/__\:\ \/__/ \:\  \ /:/  / \/__|:|/:/  /
  24.             Name: string;                               //  \:\~~\~~     \::/__/       /:/  /         |:|::/  /   \:\  /:/  /       \:\__\    \:\  /:/  /      |:/:/  /
  25. end;                                                    //   \:\  \       \:\__\       \/__/          |:|\/__/     \:\/:/  /         \/__/     \:\/:/  /       |::/  /
  26. type                                                    //    \:\__\       \/__/                      |:|  |        \::/  /                     \::/  /        /:/  /
  27.     TPlayerInfo = record                                //     \/__/                                   \|__|         \/__/                       \/__/         \/__/
  28.                 nickStatus: boolean;
  29.                 Name, Password: string;
  30.                 IP, HWID, auto, DelAcc: string;
  31.                 LoginMes: string;
  32.                 kickTimer, startKickTimer: integer;
  33. end;
  34. type
  35.     TStats = record
  36.                 Kills, TeamKills, Deaths, DeathsByTeam, SelfKills, PosKill, KillFlager: string;
  37.                 FlagGrab, FlagReturn, FlagScore, FlagDrop, Shoot, ShootHit, ShootFriendly, Wybawiciel, Zemsta, Asysta: string;
  38.                 AlphaCaps, BravoCaps, INF_Red, INF_Blue, HTF_Red, HTF_Blue, Points: string;
  39.                 Win, Lose, Remis, AlphaWins, AlphaLose, BravoWins, BravoLose, CharlieWin, CharlieLose, DeltaWin, DeltaLose: string;
  40. end;
  41. type
  42.     PlayerAssist = record
  43.                 DamageRecievedByID: array[1..33] of double;
  44.                 DamageRecievedByCooldown: array[1..33] of integer;
  45.                 KilledBy: integer;
  46. end;
  47. var
  48.     PlayerInfo: array [1..32] of TPlayerInfo;
  49.     PlayerStats: array [1..32] of TStats;
  50.     PlayersInfoArr: array[1..32] of PlayerAssist;
  51.     ranks: array of TRank;
  52.     TopMap: array of TMapRanks;
  53.     Ammo, Weap, atc, flager: array[1..32] of byte;
  54.     timer, Ttimer: array [1..32] of integer;
  55.     Revenge: array [1..32] of string;
  56.     Visit, AlphaV, BlueV, CharlieV, DeltaV, SpecV, SKill, STeamKill, SSelfkils, SKick: string;
  57.     MapKills, MapSelfkills, MapTeamkills, MapFlagCaps, MapFlagGrabs, MapFlagReturns, MapFlagDrop, MapPlayerJoins, MapPlayerLeaves, MapPlayerKicks, MapPlays, YouInfo: string;
  58.     GOOD, BAD: longint;
  59.     Mnoznik, Procent, InitTime, AddTime, KickTime, TopLines, TimeMes, MaxPointGive, MinimalKills: integer;
  60.     LimitKills, WriteLnSpam, AutoRegister, KickTimeON, TimeMesON, RealTimeUpdate, AntyMajor, TopMapsON, MapStatsON, OtherStatsON, WinStatsON, PointsForStart: String;
  61.     DisStats, DisStatsOther, DisTop, DisFlagStats, DisFlagStatsOther, DisServerStats, DisMapStats, DisTopMaps, DisLastPlayed, DisOtherStats, DisOtherOther, DisWinStats, DisWinStatsOther, DisRank, DisRankOther, DisRankID, PrevMap: string;
  62.     EnableStats, EnableTop, EnableFlagStats, EnableServerStats, EnableLastPlayed, EnableResetStats, EnableVoteUpdate, DefaultAutoLogin, AntyMulti, EnableSearch, EnableRank, EnableRankID: string;
  63.     Go: boolean;    VFor, Time: byte;   Voted: array[1..32] of boolean;
  64.     FriendlyFire, Survival: boolean;    MaxHealth, INF_BravoNewScore, HTF_BravoNewScore, HTF_AlphaNewScore, Liczba, Tysieczna: integer;
  65.  
  66. function Explode(Source: string; const Delimiter: string): array of string;
  67. var Position, DelLength, ResLength: integer;
  68. begin
  69.     DelLength := Length(Delimiter);
  70.     Source := Source + Delimiter;
  71.     repeat
  72.         Position := Pos(Delimiter, Source);
  73.         SetArrayLength(Result, ResLength + 1);
  74.         Result[ResLength] := Copy(Source, 1, Position - 1);
  75.         ResLength := (ResLength + 1);
  76.         Delete(Source, 1, Position + DelLength - 1);
  77.     until (Position = 0);
  78.     SetArrayLength(Result, ResLength - 1);
  79. end;
  80.  
  81. function LoadSettings(File: string): boolean;
  82. begin
  83.     try
  84.         GOOD := StrtoInt(ReadINI(File,'Colors','ColorGOOD','$EE00FF00'));   BAD := StrtoInt(ReadINI(File,'Colors','ColorBAD','$ff0033'));
  85.         Procent := StrtoInt(ReadINI(File,'Vote','Vote','75'));  InitTime := StrtoInt(ReadINI(File,'Vote','VoteTime','30')); AddTime := StrtoInt(ReadINI(File,'Vote','VoteTimeAdd','7'));
  86.         DefaultAutoLogin    := ReadINI(File,'Default','DefaultAutoLogin','HWID'); PointsForStart := ReadINI(File,'Default','PointsForStart','1000'); MaxPointGive := StrtoInt(ReadINI(File,'Default','MaxPointGive','50'));
  87.         Mnoznik := StrtoInt(ReadINI(File,'Stats','Multiplier','100')); LimitKills := ReadINI(File,'Stats','LimitKills','25'); TopLines := StrtoInt(ReadINI(File,'Stats','TopLines','10')); MinimalKills := StrtoInt(ReadINI(File,'Stats','MinimalKills','0')); RealTimeUpdate := ReadINI(File,'Stats','UpdateRanksRealTime','ON');
  88.         AutoRegister := ReadINI(File,'Accounts','AutoRegister','ON'); AntyMulti := ReadINI(File,'Accounts','AntyMulti','ON'); KickTime := StrtoInt(ReadINI(File,'Accounts','KickTime','15')); KickTimeON := ReadINI(File,'Accounts','KickTimeON','ON'); AntyMajor := ReadINI(File,'Accounts','AntyMajorStats','ON');
  89.         WriteLnSpam := ReadINI(File,'Messages','WriteLnSpam','OFF'); TimeMesON := ReadINI(File,'Messages','TimeMesON','ON'); TimeMes := StrtoInt(ReadINI(File,'Messages','TimeMes','1'));   YouInfo := ReadINI(File,'Messages','YouInfoHere','Bad here - Edit in Setting.ini (YouInfoHere=)');
  90.         TopMapsON := ReadINI(File,'MapStats','TopMapsON','ON'); MapStatsON := ReadINI(File,'MapStats','MapStatsON','ON');
  91.         OtherStatsON := ReadINI(File,'EnableStats','OtherStats','ON'); EnableStats := ReadINI(File,'EnableStats','Stats','ON'); EnableTop := ReadINI(File,'EnableStats','Top','ON'); EnableFlagStats := ReadINI(File,'EnableStats','FlagStats','ON'); WinStatsON := ReadINI(File,'EnableStats','WinStats','ON'); EnableServerStats := ReadINI(File,'EnableStats','ServerStats','ON');
  92.         DisStats := ReadINI(File,'PublicDisplayStats','Stats','ON'); DisStatsOther := ReadINI(File,'PublicDisplayStats','StatsOther','OFF'); DisTop := ReadINI(File,'PublicDisplayStats','Top','ON'); DisFlagStats := ReadINI(File,'PublicDisplayStats','FlagStats','ON'); DisFlagStatsOther := ReadINI(File,'PublicDisplayStats','FlagStatsOther','OFF'); DisServerStats := ReadINI(File,'PublicDisplayStats','ServerStats','ON'); DisMapStats := ReadINI(File,'PublicDisplayStats','MapStats','ON'); DisTopMaps := ReadINI(File,'PublicDisplayStats','TopMaps','ON'); DisLastPlayed := ReadINI(File,'PublicDisplayStats','LastPlayed','ON'); DisOtherStats := ReadINI(File,'PublicDisplayStats','OtherStats','ON'); DisOtherOther := ReadINI(File,'PublicDisplayStats','OtherStatsOther','OFF'); DisRank  := ReadINI(File,'PublicDisplayStats','Rank','ON'); DisRankOther := ReadINI(File,'PublicDisplayStats','RankOther','OFF'); DisRankID := ReadINI(File,'PublicDisplayStats','RankID','OFF'); DisWinStats := ReadINI(File,'PublicDisplayStats','WinStats','ON'); DisWinStatsOther := ReadINI(File,'PublicDisplayStats','WinStatsOther','OFF');
  93.         EnableLastPlayed := ReadINI(File,'EnableCommands','LastPlayed','ON'); EnableResetStats := ReadINI(File,'EnableCommands','ResetStats','ON'); EnableVoteUpdate := ReadINI(File,'EnableCommands','VoteUpdate','OFF'); EnableSearch := ReadINI(File,'EnableCommands','Search','ON'); EnableRank := ReadINI(File,'EnableCommands','Rank','ON'); EnableRankID := ReadINI(File,'EnableCommands','RankID','ON');
  94.     except
  95.         Result := true;
  96.     exit;
  97.     end;
  98. end;
  99.  
  100. function filterFilename(filename: string):string;
  101. var i,len: byte; c: string;
  102. begin
  103.     len := length(filename);
  104.     result := '';
  105.     for i := 1 to len do begin
  106.         c := copy(filename,i,1);
  107.         if (c=chr(92)) or (c='/') or (c='\') or (c=':') or (c='*') or (c='?') or (c='"') or (c='<') or (c='>') or (c='|') or (c='.') then result := result + '_' else result := result + c;
  108.     end;
  109. end;
  110.  
  111. procedure LoadNickname(ID: byte);
  112. var temparray: TStringArray;
  113. begin
  114.     if (FileExists('nickreg/'+FilterFilename(GetPlayerStat(ID,'name'))+'.txt') = true) then begin
  115.         temparray := Explode(ReadFile('nickreg/'+FilterFilename(GetPlayerStat(ID,'name'))+'.txt'),CRLF);
  116.         PlayerInfo[ID].Name := temparray[0]; PlayerInfo[ID].Password := temparray[1];   PlayerInfo[ID].IP := temparray[2];  PlayerInfo[ID].HWID := temparray[3]; PlayerInfo[ID].Auto := temparray[4];   PlayerStats[ID].PosKill := temparray[5]; PlayerInfo[ID].LoginMes := temparray[6];
  117.         PlayerStats[ID].Kills := temparray[7]; PlayerStats[ID].TeamKills := temparray[8]; PlayerStats[ID].Deaths := temparray[9]; PlayerStats[ID].DeathsByTeam:= temparray[10]; PlayerStats[ID].SelfKills := temparray[11]; PlayerStats[ID].FlagGrab    := temparray[12];
  118.         PlayerStats[ID].FlagReturn  := temparray[13]; PlayerStats[ID].FlagScore := temparray[14]; PlayerStats[ID].FlagDrop  := temparray[15]; PlayerStats[ID].AlphaCaps := temparray[16]; PlayerStats[ID].BravoCaps := temparray[17]; PlayerStats[ID].INF_Red := temparray[18];
  119.         PlayerStats[ID].INF_Blue := temparray[19]; PlayerStats[ID].HTF_Red := temparray[20]; PlayerStats[ID].HTF_Blue := temparray[21]; PlayerStats[ID].Shoot := temparray[22]; PlayerStats[ID].ShootHit    := temparray[23]; PlayerStats[ID].ShootFriendly := temparray[24];
  120.         PlayerStats[ID].Wybawiciel:= temparray[25]; PlayerStats[ID].Zemsta := temparray[26]; PlayerStats[ID].Asysta := temparray[27]; PlayerStats[ID].Win := temparray[28]; PlayerStats[ID].Lose := temparray[29]; PlayerStats[ID].Remis := temparray[30];
  121.         PlayerStats[ID].AlphaWins   := temparray[31]; PlayerStats[ID].AlphaLose := temparray[32]; PlayerStats[ID].BravoWins := temparray[33]; PlayerStats[ID].BravoLose := temparray[34]; PlayerStats[ID].CharlieWin := temparray[35]; PlayerStats[ID].CharlieLose  := temparray[36];
  122.         PlayerStats[ID].DeltaWin    := temparray[37]; PlayerStats[ID].DeltaLose := temparray[38]; PlayerStats[ID].Points := temparray[39]; PlayerStats[ID].KillFlager := temparray[40]; PlayerInfo[ID].DelAcc := temparray[41];
  123.     end else
  124.     begin
  125.         PlayerInfo[ID].LoginMes := 'OFF';
  126.         PlayerInfo[ID].NickStatus := false; PlayerInfo[ID].Name := '';  PlayerInfo[ID].Password := '';  PlayerInfo[ID].IP := '';    PlayerInfo[ID].HWID := '';  PlayerInfo[ID].Auto := '';  PlayerInfo[ID].DelAcc := 'NO';
  127.     end;
  128. end;
  129.  
  130. procedure ResetVar(b: byte);
  131. begin
  132.     PlayerInfo[b].nickStatus        := false;   PlayerInfo[b].kickTimer := 0;           PlayerInfo[b].startKickTimer    := 0;       PlayerInfo[b].Name              := '';      PlayerInfo[b].Password      := '';      PlayerInfo[b].IP            := '';
  133.     PlayerInfo[b].HWID              := '';      PlayerInfo[b].Auto          := '';      PlayerStats[b].PosKill          := '0';     PlayerInfo[b].LoginMes          := '';      PlayerInfo[b].DelAcc        := 'NO';
  134.     PlayerStats[b].Kills            := '0';     PlayerStats[b].TeamKills    := '0';     PlayerStats[b].Deaths           := '0';     PlayerStats[b].DeathsByTeam     := '0';     PlayerStats[b].SelfKills    := '0';     PlayerStats[b].FlagGrab     := '0';
  135.     PlayerStats[b].FlagReturn       := '0';     PlayerStats[b].FlagScore    := '0';     PlayerStats[b].FlagDrop         := '0';     PlayerStats[b].AlphaCaps        := '0';     PlayerStats[b].BravoCaps    := '0';
  136.     PlayerStats[b].INF_Red          := '0';     PlayerStats[b].INF_Blue     := '0';     PlayerStats[b].HTF_Red          := '0';     PlayerStats[b].HTF_Blue         := '0';     PlayerStats[b].Shoot        := '0';     PlayerStats[b].ShootHit     := '0';
  137.     PlayerStats[b].ShootFriendly    := '0';     PlayerStats[b].Wybawiciel   := '0';     PlayerStats[b].Zemsta           := '0';     PlayerStats[b].Asysta           := '0';     PlayerStats[b].KillFlager   := '0';
  138.     PlayerStats[b].Win              := '0';     PlayerStats[b].Lose         := '0';     PlayerStats[b].Remis            := '0';     PlayerStats[b].AlphaWins        := '0';     PlayerStats[b].AlphaLose    := '0';     PlayerStats[b].BravoWins    := '0';    
  139.     PlayerStats[b].BravoLose        := '0';     PlayerStats[b].CharlieWin   := '0';     PlayerStats[b].CharlieLose      := '0';     PlayerStats[b].DeltaWin         := '0';     PlayerStats[b].DeltaLose    := '0';     PlayerStats[b].Points       := PointsForStart;
  140.     flager[b]                       := 0;       Revenge[b]                  := '';
  141. end;
  142.  
  143. function MD5Issue(const S: string): string;
  144. begin
  145.     while (not(RegExpMatch('^[0-9a-f]{32}$', Result))) do begin
  146.         Result:= MD5String(S);
  147.     end;
  148. end;
  149.  
  150. function StrToID(s: string): byte;
  151. var i: byte;
  152. begin
  153.     Result := 254;
  154.     try
  155.         if GetPlayerStat(StrToInt(s), 'active') then Result := StrToInt(s);
  156.     except
  157.         s := LowerCase(s);
  158.         for i := 1 to 32 do if GetPlayerStat(i, 'active') then if ContainsString(LowerCase(IDToName(i)), s) then begin
  159.             Result := i;
  160.             break;
  161.         end;
  162.     end;
  163. end;
  164.  
  165. function WowSuchASpeed(a: double; b: integer): double;
  166. var c: double;
  167. begin
  168.     if (b = 0) then result := 1 else if b mod 2 = 1 then result := (WowSuchASpeed(a, b-1) * a) else begin
  169.         c := WowSuchASpeed(a, b div 2);
  170.         result := (c * c);
  171.     end;
  172. end;
  173.  
  174. function WowItsEvenFaster(a: double; b: longint): double;
  175. var l, r, s, p: int64; AlgorithmsAreSoEZ: double;
  176. begin
  177.     p := round(WowSuchASpeed(10, precision));
  178.     l := 0;
  179.     r := p;
  180.     while(l<r) do begin
  181.         s := (l+r) div 2;
  182.         AlgorithmsAreSoEZ := s;
  183.         if (WowSuchASpeed(AlgorithmsAreSoEZ, b) > a) then r := s else l := (s + 1);
  184.     end;
  185.     result := (l-1);
  186.     l := 0;
  187.     r := (p-1);
  188.     while(l<r) do begin
  189.         s := (l+r) div 2;
  190.         AlgorithmsAreSoEZ := s;
  191.         AlgorithmsAreSoEZ := (AlgorithmsAreSoEZ / p);
  192.         AlgorithmsAreSoEZ := (AlgorithmsAreSoEZ + result);
  193.         if (WowSuchASpeed(AlgorithmsAreSoEZ, b) > a) then r := s else l := (s + 1);
  194.     end;
  195.     AlgorithmsAreSoEZ := (l - 1);
  196.     AlgorithmsAreSoEZ := (AlgorithmsAreSoEZ / p);
  197.     result := (result + AlgorithmsAreSoEZ);
  198. end;
  199.  
  200. procedure ABP(c: double);
  201. var c1, c2: string; i, b: byte;
  202. begin
  203.     if (c<>0) then begin
  204.         c1 := FloatToStr(c);
  205.         c1 := GetPiece(c1, '.', 1);
  206.         for i := 1 to Length(c1) do if (strtoint(c1[i]) <> 0) then begin
  207.             Liczba := strtoint(c1[i]);
  208.             c2 := '1';
  209.             for b := 1 to i do c2 := c2 + '0';
  210.             Tysieczna := strtoint(c2);
  211.             break;
  212.         end;
  213.     end else
  214.     begin
  215.         Liczba := 0;
  216.         Tysieczna := 0;
  217.     end;
  218. end;
  219.  
  220. function Punkty2(Killer, Victim: byte): integer;
  221. var c: double; c1: string; c4: integer; x, x2, x3: double;
  222. begin
  223.     c := (single(strtoint(PlayerStats[Killer].Points)-strtoint(PlayerStats[Victim].Points))/1000);
  224.     if (c >= 1) or (c <= -1) then begin
  225.         c1 := FloatToStr(c);
  226.         if (c > 0) then x := WowSuchASpeed(10,strtoint(Copy(c1,1,1))) else x := WowSuchASpeed(10,strtoint(Copy(c1,1,2)));
  227.         ABP(c);
  228.         if (Liczba >= 1) or (Liczba <= -1) then x2 := Round(WowItsEvenFaster(WowSuchASpeed(10, Liczba), Tysieczna)) else x2 := 0;
  229.         x3 := (single(x)*single(x2));
  230.         c4 := Round(MaxPointGive/single(1+x3));
  231.         Result := c4;
  232.     end else
  233.     begin
  234.         ABP(c);
  235.         if (Liczba >= 1) or (Liczba <= -1) then c4 := Round(WowItsEvenFaster(WowSuchASpeed(10, Liczba), Tysieczna)) else c4 := 0;
  236.         c4 := Round(MaxPointGive/single(1+c4));
  237.         Result := c4;
  238.     end;
  239. end;
  240.  
  241. function Punkty(ID: byte): integer;
  242. var d, kd: integer; cel, KD2, KD3: double;
  243. begin
  244.     if (GameStyle = 0) or (GameStyle = 1) or (GameStyle = 4) then begin
  245.         cel := (single(strtoint(PlayerStats[ID].ShootHit))*100/Single(strtoint(PlayerStats[ID].Shoot)));
  246.         if (cel > 100) then cel := 100.00;
  247.         KD2 := (single(strtoint(PlayerStats[ID].TeamKills))/single(strtoint(PlayerStats[ID].Deaths)));
  248.         KD2 := strtofloat(FormatFloat('0.00',KD2));
  249.         if (strtoint(PlayerStats[ID].Lose) > 0) then KD3 := (strtoint(PlayerStats[ID].Win)/strtoint(PlayerStats[ID].Lose));
  250.         if (KD3 <= 0) then KD3 := 1;
  251.         KD := round((cel * KD2 * KD3 * Mnoznik) / 3.14);
  252.         if (KD > 0) then d := KD+round((cel/100)*KD) else d := KD+round((cel/100)*(KD*-1));
  253.         result := d;
  254.     end;
  255.     if (GameStyle = 2) or (GameStyle = 3) or (GameStyle = 5) or (GameStyle = 6) then begin
  256.         if (FriendlyFire) then begin
  257.             cel := (single(strtoint(PlayerStats[ID].ShootHit))*100/Single(strtoint(PlayerStats[ID].Shoot)));
  258.             if (cel > 100) then cel := 100.00;
  259.             KD2 := (single(strtoint(PlayerStats[ID].Kills)-strtoint(PlayerStats[ID].TeamKills))/single(strtoint(PlayerStats[ID].Deaths)));
  260.             KD2 := strtofloat(FormatFloat('0.00',KD2));
  261.             if (strtoint(PlayerStats[ID].Lose) > 0) then KD3 := (strtoint(PlayerStats[ID].Win)/strtoint(PlayerStats[ID].Lose));
  262.             if (KD3 <= 0) then KD3 := 1;
  263.             KD := round((cel * KD2 * KD3 * Mnoznik) / 3.14);
  264.             if (KD > 0) then d := KD+round((cel/100)*KD) else d := KD+round((cel/100)*(KD*-1));
  265.             result := d;
  266.         end else
  267.         begin
  268.             cel := (single(strtoint(PlayerStats[ID].ShootHit))*100/Single(strtoint(PlayerStats[ID].Shoot)));
  269.             if (cel > 100) then cel := 100.00;
  270.             KD2 := (single(strtoint(PlayerStats[ID].Kills))/single(strtoint(PlayerStats[ID].Deaths)));
  271.             KD2 := strtofloat(FormatFloat('0.00',KD2));
  272.             if (strtoint(PlayerStats[ID].Lose) > 0) then KD3 := (strtoint(PlayerStats[ID].Win)/strtoint(PlayerStats[ID].Lose));
  273.             if (KD3 <= 0) then KD3 := 1;
  274.             KD := round((cel * KD2 * KD3 * Mnoznik) / 3.14);
  275.             if (KD > 0) then d := KD+round((cel/100)*KD) else d := KD+round((cel/100)*(KD*-1));
  276.             result := d;
  277.         end;
  278.     end;
  279. end;
  280.  
  281. procedure UpdateNickname(ID: byte);
  282. var outdata: string;
  283. begin
  284.     if (PlayerInfo[ID].NickStatus = true) then begin
  285.         outdata :=  PlayerInfo[ID].Name+CRLF+PlayerInfo[ID].Password+CRLF+GetPlayerStat(ID,'IP')+CRLF+GetPlayerStat(ID,'HWID')+CRLF+PlayerInfo[ID].Auto+CRLF+PlayerStats[ID].PosKill+CRLF+PlayerInfo[ID].LoginMes+CRLF+PlayerStats[ID].Kills+CRLF+
  286.                     PlayerStats[ID].TeamKills+CRLF+PlayerStats[ID].Deaths+CRLF+PlayerStats[ID].DeathsByTeam+CRLF+PlayerStats[ID].SelfKills+CRLF+PlayerStats[ID].FlagGrab+CRLF+PlayerStats[ID].FlagReturn+CRLF+PlayerStats[ID].FlagScore+CRLF+
  287.                     PlayerStats[ID].FlagDrop+CRLF+PlayerStats[ID].AlphaCaps+CRLF+PlayerStats[ID].BravoCaps+CRLF+PlayerStats[ID].INF_Red+CRLF+PlayerStats[ID].INF_Blue+CRLF+PlayerStats[ID].HTF_Red+CRLF+PlayerStats[ID].HTF_Blue+CRLF+PlayerStats[ID].Shoot+CRLF+
  288.                     PlayerStats[ID].ShootHit+CRLF+PlayerStats[ID].ShootFriendly+CRLF+PlayerStats[ID].Wybawiciel+CRLF+PlayerStats[ID].Zemsta+CRLF+PlayerStats[ID].Asysta+CRLF+PlayerStats[ID].Win+CRLF+PlayerStats[ID].Lose+CRLF+PlayerStats[ID].Remis+CRLF+
  289.                     PlayerStats[ID].AlphaWins+CRLF+PlayerStats[ID].AlphaLose+CRLF+PlayerStats[ID].BravoWins+CRLF+PlayerStats[ID].BravoLose+CRLF+PlayerStats[ID].CharlieWin+CRLF+PlayerStats[ID].CharlieLose+CRLF+PlayerStats[ID].DeltaWin+CRLF+
  290.                     PlayerStats[ID].DeltaLose+CRLF+PlayerStats[ID].Points+CRLF+PlayerStats[ID].KillFlager+CRLF+PlayerInfo[ID].DelAcc+CRLF+FormatDate('dd mmmm yyyy')+' at: '+ FormatDate('hh:nn:ss');
  291.         WriteFile('nickreg/'+FilterFileName(PlayerInfo[ID].Name)+'.txt',outdata);
  292.         LoadNickname(ID);
  293.     end else if (lowercase(WriteLnSpam) = lowercase('ON')) then WriteLn('Player is not logged for statistics!');
  294. end;
  295.  
  296. procedure OnPlayerShoot(ID, Weapon: byte);
  297. begin
  298.     if (lowercase(OtherStatsON) = lowercase('ON')) and (PlayerInfo[ID].NickStatus = true) and (Weapon <> 255) and (Weapon <> 14) then begin
  299.         if (Weapon <> 1) and (Weapon <> 5) then PlayerStats[ID].Shoot := inttostr(strtoint(PlayerStats[ID].Shoot) + 1);
  300.         if (Weapon = 1) then PlayerStats[ID].Shoot := inttostr(strtoint(PlayerStats[ID].Shoot) + 2);
  301.         if (Weapon = 5) then PlayerStats[ID].Shoot := inttostr(strtoint(PlayerStats[ID].Shoot) + 6);
  302.         if (lowercase(RealTimeUpdate) = lowercase('ON')) then UpdateNickname(ID);
  303.     end;
  304. end;
  305.  
  306. procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);
  307. begin
  308.     if (GetPlayerStat(ID,'Primary') = 14) then if (PrimaryNum = 255) then PlayerStats[ID].Shoot := inttostr(strtoint(PlayerStats[ID].Shoot) + 1);
  309. end;
  310.  
  311. procedure ShootKeyCheck();
  312. var i: byte;
  313. begin
  314.     for i := 1 to 32 do if (GetPlayerStat(i,'Active') = true) and (GetPlayerStat(i,'Ammo') <> Ammo[i]) then begin
  315.         if (GetKeyPress(i, 'Shoot') = true) and (GetPlayerStat(i,'Primary') = Weap[i]) and (GetPlayerStat(i,'Ammo') >= 0) and (GetPlayerStat(i,'Ammo') < Ammo[i]) then OnPlayerShoot(i,GetPlayerStat(i,'Primary'));
  316.         Weap[i] := GetPlayerStat(i,'Primary');
  317.         Ammo[i] := GetPlayerStat(i,'Ammo');
  318.     end;
  319. end;
  320.  
  321. procedure CreateServerStats();
  322. var outdata: string;
  323. begin
  324.     if (FileExists('nickreg/server/stats.txt') = false) and (lowercase(EnableServerStats) = lowercase('ON')) then begin
  325.         outdata :=  '0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0';
  326.         WriteFile('nickreg/server/stats.txt',outdata);
  327.         WriteLn(' [*] '+ ScriptName + ' (AutoRepair) Stats.txt -> None detected file, I create a new');
  328.     end;
  329.     if (FileExists('nickreg/server/rankpoint.db') = false) and (lowercase(EnableTop) = lowercase('ON')) then begin
  330.         WriteFile('nickreg/server/rankpoint.db','');
  331.         WriteLn(' [*] '+ ScriptName + ' (AutoRepair) RankPoint.db -> None detected file, I create a new');
  332.     end;
  333. end;
  334.  
  335. Procedure MapStatsCreate(Map: String);
  336. var outdata: string;
  337. begin
  338.     if not (Map = '') then if (FileExists('nickreg/maps/'+Map+'.txt') = false) and (lowercase(MapStatsON) = lowercase('ON')) then begin
  339.         outdata :=  '0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0';
  340.         WriteFile('nickreg/maps/'+Map+'.txt',outdata);
  341.         WriteLnFile('nickreg/maps/maps.db', Map);
  342.         WriteLn(' [*] '+ ScriptName + ' (MapStats) -> Create File MapStats for '+Map);
  343.     end;
  344.     if (FileExists('nickreg/server/MapPlayed.db') = false) and (lowercase(TopMapsON) = lowercase('ON')) then begin
  345.         WriteFile('nickreg/server/MapPlayed.db','');
  346.         WriteLn(' [*] '+ ScriptName + ' (AutoRepair) MapPlayed.db -> None detected file, I create a new');
  347.     end;
  348. end;
  349.  
  350. Procedure MapStatsLoad(Map: string);
  351. var temparray: TStringArray;
  352. begin
  353.     if (FileExists('nickreg/maps/'+Map+'.txt') = true) then begin
  354.         temparray := Explode(ReadFile('nickreg/maps/'+Map+'.txt'),CRLF);
  355.             MapKills := temparray[0]; MapSelfkills := temparray[1]; MapTeamkills := temparray[2]; MapFlagCaps := temparray[3]; MapFlagGrabs := temparray[4];
  356.             MapFlagReturns := temparray[5]; MapFlagDrop := temparray[6]; MapPlays := temparray[7]; MapPlayerJoins := temparray[8]; MapPlayerLeaves := temparray[9]; MapPlayerKicks := temparray[10];
  357.     end else
  358.     begin
  359.         MapStatsCreate(Map);
  360.         if (FileExists('nickreg/maps/'+Map+'.txt') = true) then MapStatsLoad(Map);
  361.     end;
  362. end;
  363.  
  364. Procedure UpdateMapStats(Map: String);
  365. var outdata: string;
  366. begin
  367.     if (lowercase(MapStatsON) = lowercase('ON')) then begin
  368.         if (FileExists('nickreg/maps/'+Map+'.txt') = true) then begin
  369.             outdata :=  MapKills+CRLF+MapSelfkills+CRLF+MapTeamkills+CRLF+MapFlagCaps+CRLF+MapFlagGrabs+CRLF+MapFlagReturns+CRLF+MapFlagDrop+CRLF+MapPlays+CRLF+MapPlayerJoins+CRLF+MapPlayerLeaves+CRLF+MapPlayerKicks;
  370.             WriteFile('nickreg/maps/'+Map+'.txt',outdata);
  371.             MapStatsLoad(currentmap);
  372.         end;
  373.     end;
  374. end;
  375.  
  376. procedure AutoSaveNickname(auto: string; ID: byte);
  377. var outdata: string;
  378. begin
  379.     if (FileExists('nickreg/'+FilterFilename(GetPlayerStat(ID,'name'))+'.txt') = false) or (PlayerInfo[ID].DelAcc = 'YES') then begin
  380.         outdata :=  GetPlayerStat(ID,'name')+CRLF+''+CRLF+GetPlayerStat(ID,'ip')+CRLF+GetPlayerStat(ID,'HWID')+CRLF+auto+CRLF+'0'+CRLF+'OFF'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+
  381.                     '0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+
  382.                     '0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+PointsForStart+CRLF+'0'+CRLF+'NO'+CRLF+FormatDate('dd mmmm yyyy')+' at: '+ FormatDate('hh:nn:ss');
  383.         WriteFile('nickreg/'+FilterFilename(GetPlayerStat(ID,'name'))+'.txt',outdata);
  384.         if (PlayerInfo[ID].DelAcc = 'NO') then WriteLnFile('nickreg/server/players.db',GetPlayerStat(ID,'name'));
  385.     end else WriteConsole(ID,'Nickname already exists!',BAD);
  386. end;
  387.  
  388. procedure SaveNickname(password,auto: string; ID: byte);
  389. var outdata: string;
  390. begin
  391.     if (FileExists('nickreg/'+FilterFilename(GetPlayerStat(ID,'name'))+'.txt') = false) or (PlayerInfo[ID].DelAcc = 'YES') then begin
  392.         outdata :=  GetPlayerStat(ID,'name')+CRLF+password+CRLF+GetPlayerStat(ID,'ip')+CRLF+GetPlayerStat(ID,'HWID')+CRLF+auto+CRLF+'0'+CRLF+'OFF'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+
  393.                     '0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+
  394.                     '0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+PointsForStart+CRLF+'0'+CRLF+'NO'+CRLF+FormatDate('dd mmmm yyyy')+' at: '+ FormatDate('hh:nn:ss');
  395.         WriteFile('nickreg/'+FilterFilename(GetPlayerStat(ID,'name'))+'.txt',outdata);
  396.         if (PlayerInfo[ID].DelAcc = 'NO') then WriteLnFile('nickreg/server/players.db',GetPlayerStat(ID,'name'));
  397.     end else WriteConsole(ID,'Nickname already exists!',BAD);
  398. end;
  399.  
  400. procedure ServerLoad();
  401. var temparray: TStringArray;
  402. begin
  403.     if (FileExists('nickreg/server/stats.txt') = true) then begin
  404.         temparray := Explode(ReadFile('nickreg/server/stats.txt'),CRLF);
  405.         Visit := temparray[0];      AlphaV := temparray[1];         BlueV := temparray[2];          CharlieV := temparray[3];       DeltaV := temparray[4];     SpecV := temparray[5];
  406.         SKill := temparray[6];      STeamKill := temparray[7];      SSelfkils := temparray[8];      SKick := temparray[9];
  407.     end;
  408. end;
  409.  
  410. procedure UpdateServStats();
  411. var outdata: string;
  412. begin
  413.     if (FileExists('nickreg/server/stats.txt') = true) then begin
  414.         outdata :=  Visit+CRLF+AlphaV+CRLF+BlueV+CRLF+CharlieV+CRLF+DeltaV+CRLF+SpecV+CRLF+SKill+CRLF+STeamKill+CRLF+SSelfkils+CRLF+SKick;
  415.         WriteFile('nickreg/server/stats.txt',outdata);
  416.         if (lowercase(EnableServerStats) = lowercase('ON')) then ServerLoad();
  417.     end;
  418. end;
  419.  
  420. procedure ResetSeverStats();
  421. var outdata: string;
  422. begin
  423.     outdata :=  '0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0';
  424.     WriteFile('nickreg/server/stats.txt',outdata);
  425.     ServerLoad();
  426. end;
  427.  
  428. procedure LoadRanks();
  429. var i: word; data: array of string;
  430. begin
  431.     ranks := [];
  432.     if (FileExists('nickreg/server/rankpoint.db')) then begin
  433.         data := Explode(ReadFile('nickreg/server/rankpoint.db'), CRLF);
  434.         SetArrayLength(ranks, GetArrayLength(data) div 2);
  435.         if (GetArrayLength(ranks) > 0) then for i := 0 to GetArrayLength(ranks) - 1 do begin
  436.             ranks[i].Name := data[i * 2];
  437.             ranks[i].Points := StrtoInt(data[i * 2 + 1]);
  438.         end;
  439.     end;
  440. end;
  441.  
  442. procedure DeleteInRank(ID:byte);
  443. var i:word; outdata:string;
  444. begin
  445.     outdata := '';
  446.     if (GetArrayLength(ranks) > 0) then begin
  447.         for i := 0 to GetArrayLength(ranks) - 1 do begin
  448.             if (ranks[i].Name = GetPlayerStat(ID, 'Name')) then if (GetArrayLength(ranks)<=1) then begin
  449.                 outdata := '';
  450.                 break;
  451.             end else i:=i+1;
  452.             outdata := outdata + ranks[i].Name + CRLF + inttostr(ranks[i].Points) + CRLF;
  453.         end;
  454.         Delete(outdata, Length(outdata) - 1, 2);
  455.     end;
  456.     WriteFile('nickreg/server/rankpoint.db', outdata);
  457.     LoadRanks();
  458. end;
  459.  
  460. procedure RestartRank();
  461. var i: word; outdata: string; gracze, temparray: TStringArray; b: byte; n, n3: integer; n2: double;
  462. begin
  463.     gracze := Explode(ReadFile('nickreg/server/players.db'),CRLF);
  464.     n := 1;
  465.     n3 := ((GetArrayLength(gracze)-1)+(GetArrayLength(ranks)-2));
  466.     for i:= 2 to (GetArrayLength(gracze)-1) do begin
  467.         if (FileExists('nickreg/'+filterFileName(gracze[i-1])+'.txt') = true) then begin
  468.             n := n+1;
  469.             temparray := Explode(ReadFile('nickreg/'+filterFileName(gracze[i-1])+'.txt'),CRLF);
  470.             outdata :=  temparray[0]+CRLF+temparray[1]+CRLF+temparray[2]+CRLF+temparray[3]+CRLF+temparray[4]+CRLF+temparray[5]+CRLF+temparray[6]+CRLF+temparray[7]+CRLF+temparray[8]+CRLF+temparray[9]+CRLF+temparray[10]+CRLF+temparray[11]+CRLF+temparray[12]+CRLF+
  471.                         temparray[13]+CRLF+temparray[14]+CRLF+temparray[15]+CRLF+temparray[16]+CRLF+temparray[17]+CRLF+temparray[18]+CRLF+temparray[19]+CRLF+temparray[20]+CRLF+temparray[21]+CRLF+temparray[22]+CRLF+temparray[23]+CRLF+temparray[24]+CRLF+
  472.                         temparray[25]+CRLF+temparray[26]+CRLF+temparray[27]+CRLF+temparray[28]+CRLF+temparray[29]+CRLF+temparray[30]+CRLF+temparray[31]+CRLF+temparray[32]+CRLF+temparray[33]+CRLF+temparray[34]+CRLF+temparray[35]+CRLF+temparray[36]+CRLF+
  473.                         temparray[37]+CRLF+temparray[38]+CRLF+PointsForStart+CRLF+temparray[40]+CRLF+temparray[41]+CRLF+FormatDate('dd mmmm yyyy')+' at: '+ FormatDate('hh:nn:ss')+' - ResetRanks';
  474.             WriteFile('nickreg/'+filterFileName(gracze[i-1])+'.txt',outdata);
  475.             n2 := ((single(n)/single(n3))*100);
  476.             DrawTextEx(0,73,'Restart Ranks: '+FormatFloat('0.00',n2)+'%',120,$FF0000,0.065,48,400);
  477.         end;
  478.     end;
  479.     for b := 1 to 32 do if (GetPlayerStat(b, 'Active')=true) then LoadNickname(b);
  480.     outdata := '';
  481.     if (GetArrayLength(ranks) > 0) then begin
  482.         for i := 0 to GetArrayLength(ranks) - 1 do begin
  483.             n := n+1;
  484.             outdata := outdata + ranks[i].Name + CRLF + PointsForStart + CRLF;
  485.             n2 := ((single(n)/single(n3))*100);
  486.             DrawTextEx(0,73,'Restart Ranks: '+FormatFloat('0.00',n2)+'%',120,$FF0000,0.065,48,400);
  487.         end;
  488.         Delete(outdata, Length(outdata) - 1, 2);
  489.     end;
  490.     WriteFile('nickreg/server/rankpoint.db', outdata);
  491.     LoadRanks();
  492.     DrawTextEx(0,73,'Restart Ranks: Completed!',260,$FF0000,0.065,48,400);
  493. end;
  494.  
  495. procedure SaveRanks();
  496. var i: word; buffer: string;
  497. begin
  498.     buffer := '';
  499.     if (GetArrayLength(ranks) > 0) then begin
  500.         for i := 0 to GetArrayLength(ranks) - 1 do buffer := buffer + ranks[i].Name + CRLF + InttoStr(ranks[i].Points) + CRLF;
  501.         Delete(buffer, Length(buffer) - 1, 2);
  502.     end;
  503.     WriteFile('nickreg/server/rankpoint.db', buffer);
  504. end;
  505.  
  506. procedure UpdateRanks(ID: byte);
  507. var i, j, lowpoints: integer;
  508. begin
  509.     if (GetArrayLength(ranks) = 0) then lowpoints := 0 else lowpoints := ranks[GetArrayLength(ranks) - 1].Points;
  510.     if (strtoint(iif((GameStyle = 0) or (GameStyle = 1) or (GameStyle = 4),PlayerStats[ID].TeamKills,PlayerStats[ID].Kills)) >= StrtoInt(LimitKills)) then begin
  511.         if ((strtoint(PlayerStats[ID].Points) > lowpoints) or (GetArrayLength(ranks) < rank_store)) then begin
  512.             for i := 0 to GetArrayLength(ranks) - 1 do if (ranks[i].Name = GetPlayerStat(ID, 'Name')) then begin
  513.                 if (GetArrayLength(ranks) >= i + 2) then for j := i + 1 to GetArrayLength(ranks) - 1 do begin
  514.                     ranks[j - 1].Name := ranks[j].Name;
  515.                     ranks[j - 1].Points := ranks[j].Points;
  516.                 end;
  517.                 SetArrayLength(ranks, GetArrayLength(ranks) - 1);
  518.                 break;
  519.             end;
  520.             for i := 0 to GetArrayLength(ranks) - 1 do if (strtoint(PlayerStats[ID].Points) > ranks[i].Points) then break;
  521.             SetArrayLength(ranks, GetArrayLength(ranks) + 1);
  522.             if (GetArrayLength(ranks) >= i + 2) then for j := GetArrayLength(ranks) - 1 downto i + 1 do begin
  523.                 ranks[j].Name := ranks[j - 1].Name;
  524.                 ranks[j].Points := ranks[j - 1].Points;
  525.             end;
  526.             ranks[i].Name := GetPlayerStat(ID, 'Name');
  527.             ranks[i].Points := strtoint(PlayerStats[ID].Points);
  528.         end;
  529.     end;
  530. end;
  531.  
  532. procedure LoadTopMap();
  533. var i: word; data: array of string;
  534. begin
  535.     TopMap := [];
  536.     if (FileExists('nickreg/server/MapPlayed.db')) then begin
  537.         data := Explode(ReadFile('nickreg/server/MapPlayed.db'), CRLF);
  538.         SetArrayLength(TopMap, GetArrayLength(data) div 2);
  539.         if (GetArrayLength(TopMap) > 0) then for i := 0 to GetArrayLength(TopMap) - 1 do begin
  540.             TopMap[i].Name := data[i * 2];
  541.             TopMap[i].Played := StrtoInt(data[i * 2 + 1]);
  542.         end;
  543.     end;
  544. end;
  545.  
  546. procedure ResetMapPlayed();
  547. var outdata: string; mapy, temparray: TStringArray; i, n, n3: word; n2: double;
  548. begin
  549.     mapy := Explode(ReadFile('nickreg/maps/maps.db'),CRLF);
  550.     n := 1;
  551.     n3 := ((GetArrayLength(mapy)-1)+(GetArrayLength(TopMap)-2));
  552.     for i:= 2 to (GetArrayLength(mapy)-1) do begin
  553.         if (FileExists('nickreg/maps/'+mapy[i-1]+'.txt') = true) then begin
  554.             n := n+1;
  555.             temparray := Explode(ReadFile('nickreg/maps/'+mapy[i-1]+'.txt'),CRLF);
  556.             outdata :=  temparray[0]+CRLF+temparray[1]+CRLF+temparray[2]+CRLF+temparray[3]+CRLF+temparray[4]+CRLF+temparray[5]+CRLF+temparray[6]+CRLF+temparray[7]+CRLF+'0'+CRLF+temparray[9]+CRLF+temparray[10];
  557.             WriteFile('nickreg/maps/'+mapy[i-1]+'.txt',outdata);
  558.             n2 := ((single(n)/single(n3))*100);
  559.             DrawTextEx(0,73,'Restart all map played: '+FormatFloat('0.00',n2)+'%',120,$FF0000,0.065,48,400);
  560.         end;
  561.     end;
  562.     MapStatsLoad(currentmap);
  563.     outdata := '';
  564.     if (GetArrayLength(TopMap) > 0) then begin
  565.         for i := 0 to GetArrayLength(TopMap) - 1 do begin
  566.             n := n+1;
  567.             outdata := outdata + TopMap[i].Name + CRLF + '0' + CRLF;
  568.             n2 := ((single(n)/single(n3))*100);
  569.             DrawTextEx(0,73,'Restart all map played: '+FormatFloat('0.00',n2)+'%',120,$FF0000,0.065,48,400);
  570.         end;
  571.         Delete(outdata, Length(outdata) - 1, 2);
  572.     end;
  573.     WriteFile('nickreg/server/MapPlayed.db', outdata);
  574.     LoadTopMap();
  575.     DrawTextEx(0,73,'Restart all map played: Completed!',260,$FF0000,0.065,48,400);
  576. end;
  577.  
  578. procedure SaveTopMap();
  579. var i: word; buffer: string;
  580. begin
  581.     buffer := '';
  582.     if (GetArrayLength(TopMap) > 0) then begin
  583.         for i := 0 to GetArrayLength(TopMap) - 1 do buffer := buffer + TopMap[i].Name + CRLF + InttoStr(TopMap[i].Played) + CRLF;
  584.         Delete(buffer, Length(buffer) - 1, 2);
  585.     end;
  586.     WriteFile('nickreg/server/MapPlayed.db', buffer);
  587. end;
  588.  
  589. procedure UpdateTopMap();
  590. var i, j, lowPlayed: integer;
  591. begin
  592.     if (GetArrayLength(TopMap) = 0) then lowPlayed := 0 else lowPlayed := TopMap[GetArrayLength(TopMap) - 1].Played;
  593.     if ((strtoint(MapPlays) > lowPlayed) or (GetArrayLength(TopMap) < rank_store)) then begin
  594.         for i := 0 to GetArrayLength(TopMap) - 1 do if (TopMap[i].Name = PrevMap) then begin
  595.             if (GetArrayLength(TopMap) >= i + 2) then for j := i + 1 to GetArrayLength(TopMap) - 1 do begin
  596.                 TopMap[j - 1].Name := TopMap[j].Name;
  597.                 TopMap[j - 1].Played := TopMap[j].Played;
  598.             end;
  599.             SetArrayLength(TopMap, GetArrayLength(TopMap) - 1);
  600.             break;
  601.         end;
  602.         for i := 0 to GetArrayLength(TopMap) - 1 do if (strtoint(MapPlays) > TopMap[i].Played) then break;
  603.         SetArrayLength(TopMap, GetArrayLength(TopMap) + 1);
  604.         if (GetArrayLength(TopMap) >= i + 2) then for j := GetArrayLength(TopMap) - 1 downto i + 1 do begin
  605.             TopMap[j].Name := TopMap[j - 1].Name;
  606.             TopMap[j].Played := TopMap[j - 1].Played;
  607.         end;
  608.         TopMap[i].Name := PrevMap;
  609.         TopMap[i].Played := strtoint(MapPlays);
  610.     end;
  611. end;
  612.  
  613. procedure LastPlay(ID:byte; Name: string);
  614. var op: integer; temparray: TStringArray; fileData: string; tr: byte;
  615. begin
  616.     if (lowercase(EnableLastPlayed) = lowercase('ON')) then begin
  617.         op := StrToID(Name);    tr := 0;
  618.         if (FileExists('nickreg/'+filterFileName(Name)+'.txt') = true) then begin
  619.             filedata := ReadFile('nickreg/'+filterFileName(Name)+'.txt');
  620.             temparray := Explode(filedata,CRLF);
  621.             tr := 1;
  622.         end else
  623.         begin
  624.             if (op = 254) then WriteConsole(ID,'Player not found ('+Name+')',BAD) else begin
  625.                 if (FileExists('nickreg/'+filterFileName(getPlayerStat(op,'Name'))+'.txt') = true) then begin
  626.                     filedata := ReadFile('nickreg/'+filterFileName(getPlayerStat(op,'Name'))+'.txt');
  627.                     temparray := Explode(filedata,CRLF);
  628.                     tr := 2;
  629.                 end;
  630.             end;
  631.         end;
  632.         if (tr = 1) or (tr = 2) then WriteConsole(iif(lowercase(DisLastPlayed) = lowercase('ON'),0,ID),'Player '+iif(tr=1,Name,getPlayerStat(op,'Name'))+' seen lately: '+temparray[42],GOOD);
  633.     end else WriteConsole(ID,'Function deactivated by an administrator!',BAD);
  634. end;
  635.  
  636. procedure ResetPlayerStats(ID: byte);
  637. var outdata: string;
  638. begin
  639.     outdata :=  PlayerInfo[ID].Name+CRLF+PlayerInfo[ID].Password+CRLF+GetPlayerStat(ID,'ip')+CRLF+GetPlayerStat(ID,'HWID')+CRLF+PlayerInfo[ID].Auto+CRLF+'0'+CRLF+'OFF'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+
  640.                 '0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+
  641.                 '0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+PointsForStart+CRLF+'0'+CRLF+PlayerInfo[ID].DelAcc+CRLF+FormatDate('dd mmmm yyyy')+' at: '+ FormatDate('hh:nn:ss');
  642.     WriteFile('nickreg/'+filterFileName(GetPlayerStat(ID,'name'))+'.txt',outdata);
  643.     LoadNickname(ID);
  644.     DeleteInRank(ID);
  645. end;
  646.  
  647. procedure RestartAllPlayerStats();
  648. var gracze, temparray: TStringArray; i, n, n3: word; outdata: string; b: byte; n2: double;
  649. begin
  650.     gracze := Explode(ReadFile('nickreg/server/players.db'),CRLF);
  651.     n := 1;
  652.     n3 := ((GetArrayLength(gracze)-1)+(GetArrayLength(ranks)-2));
  653.     for i:= 1 to (GetArrayLength(gracze)-1) do begin
  654.         if (FileExists('nickreg/'+filterFileName(gracze[i-1])+'.txt') = true) then begin
  655.             n := n+1;
  656.             temparray := Explode(ReadFile('nickreg/'+filterFileName(gracze[i-1])+'.txt'),CRLF);
  657.             outdata :=  temparray[0]+CRLF+temparray[1]+CRLF+temparray[2]+CRLF+temparray[3]+CRLF+temparray[4]+CRLF+temparray[5]+CRLF+temparray[6]+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+
  658.                     '0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+
  659.                     '0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+PointsForStart+CRLF+'0'+CRLF+temparray[41]+CRLF+FormatDate('dd mmmm yyyy')+' at: '+FormatDate('hh:nn:ss')+' - Restart';
  660.             WriteFile('nickreg/'+filterFileName(gracze[i-1])+'.txt',outdata);
  661.             n2 := ((single(n)/single(n3))*100);
  662.             DrawTextEx(0,73,'Restart all players stats: '+FormatFloat('0.00',n2)+'%',120,$FF0000,0.065,48,400);
  663.         end;
  664.     end;
  665.     for b := 1 to 32 do if (GetPlayerStat(b, 'Active')=true) then LoadNickname(b);
  666.     outdata := '';
  667.     if (GetArrayLength(ranks) > 0) then begin
  668.         for i := 0 to GetArrayLength(ranks) - 1 do begin
  669.             n := n+1;
  670.             outdata := outdata + ranks[i].Name + CRLF + PointsForStart + CRLF;
  671.             n2 := ((single(n)/single(n3))*100);
  672.             DrawTextEx(0,73,'Restart all players stats: '+FormatFloat('0.00',n2)+'%',120,$FF0000,0.065,48,400);
  673.         end;
  674.         Delete(outdata, Length(outdata) - 1, 2);
  675.     end;
  676.     WriteFile('nickreg/server/rankpoint.db', outdata);
  677.     LoadRanks();
  678.     DrawTextEx(0,73,'Restart all players stats: Completed!',260,$FF0000,0.065,48,400);
  679. end;
  680.  
  681. procedure RestartAllMapStats();
  682. var mapy: TStringArray; outdata: string; i, n, n3: word; n2: double;
  683. begin
  684.     mapy := Explode(ReadFile('nickreg/maps/maps.db'),CRLF);
  685.     n := 1;
  686.     n3 := ((GetArrayLength(mapy)-1)+(GetArrayLength(TopMap)-2));
  687.     for i:= 1 to (GetArrayLength(mapy)-1) do begin
  688.         if (FileExists('nickreg/maps/'+mapy[i-1]+'.txt') = true) then begin
  689.             n := n+1;
  690.             outdata :=  '0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0'+CRLF+'0';
  691.             WriteFile('nickreg/maps/'+mapy[i-1]+'.txt',outdata);
  692.             n2 := ((single(n)/single(n3))*100);
  693.             DrawTextEx(0,73,'Restart all maps stats: '+FormatFloat('0.00',n2)+'%',120,$FF0000,0.065,48,400);
  694.         end;
  695.         MapStatsLoad(currentmap);
  696.     end;
  697.     outdata := '';
  698.     if (GetArrayLength(TopMap) > 0) then begin
  699.         for i := 0 to GetArrayLength(TopMap) - 1 do begin
  700.             n := n+1;
  701.             outdata := outdata + TopMap[i].Name + CRLF + '0' + CRLF;
  702.             n2 := ((single(n)/single(n3))*100);
  703.             DrawTextEx(0,73,'Restart all maps stats: '+FormatFloat('0.00',n2)+'%',120,$FF0000,0.065,48,400);
  704.         end;
  705.         Delete(outdata, Length(outdata) - 1, 2);
  706.     end;
  707.     WriteFile('nickreg/server/MapPlayed.db', outdata);
  708.     LoadTopMap();
  709.     DrawTextEx(0,73,'Restart all maps stats: Completed!',260,$FF0000,0.065,48,400);
  710. end;
  711.  
  712. function OnCommand(ID: Byte; Text: string): boolean;
  713. var i: byte;
  714. begin
  715.     if (lowercase(Text) = lowercase('/ResetAllMapStats')) then begin
  716.         RestartAllMapStats();
  717.         WriteConsole(0,'Restarted all map statystic!',GOOD);
  718.     end;
  719.     if (lowercase(Text) = lowercase('/ResetAllPlayerStats')) then begin
  720.         RestartAllPlayerStats();
  721.         WriteConsole(0,'Restarted statistics of all players.',GOOD);
  722.     end;
  723.     if (lowercase(Text) = lowercase('/UpdateStats')) then begin
  724.         UpdateServStats();
  725.         for i := 1 to 32 do if (GetPlayerStat(i, 'Active') = true) then begin
  726.             UpdateNickname(i);
  727.             if (lowercase(EnableTop) = lowercase('ON')) then begin
  728.                 if (GetPlayerStat(i, 'Human') = true) then UpdateRanks(i);
  729.                 SaveRanks();
  730.                 WriteConsole(i,'Update Stats!',GOOD);
  731.             end;
  732.         end;
  733.     end;
  734.     if MaskCheck(lowercase(Text),'/deleteacc *') then begin
  735.         if (GetPiece(Text,' ',1) <> '') then begin
  736.             try
  737.                 i := strtoint(GetPiece(Text,' ',1));
  738.                 if (GetPlayerStat(i,'Active') = true) then begin
  739.                     if (FileExists('nickreg/'+FilterFilename(GetPlayerStat(i,'name'))+'.txt') = true) then begin
  740.                         if (PlayerInfo[ID].DelAcc = 'NO') then begin
  741.                             DeleteInRank(ID);
  742.                             PlayerInfo[i].DelAcc := 'YES';
  743.                             UpdateNickname(i);
  744.                             PlayerInfo[i].nickStatus := false;
  745.                             WriteConsole(ID,'Player account '+GetPlayerStat(strtoint(GetPiece(Text,' ',1)),'Name')+' successfully removed.',GOOD);
  746.                             WriteConsole(i,' ',GOOD);   WriteConsole(i,' ',GOOD);   WriteConsole(i,' ',GOOD);   WriteConsole(i,' ',GOOD);
  747.                             WriteConsole(i,'                    Your account has been deleted.',BAD);
  748.                             WriteConsole(i,'                           You logged out!        ',BAD);
  749.                             WriteConsole(i,' ',GOOD);   WriteConsole(i,' ',GOOD);   WriteConsole(i,' ',GOOD);
  750.                         end else WriteConsole(ID,'His player does not have a account.',BAD);
  751.                     end else WriteConsole(ID,'His player does not have a account.',BAD);
  752.                  end else WriteConsole(ID,'None such player.',BAD);
  753.             except WriteConsole(ID,'ID an incorrect.',BAD);
  754.             end;
  755.         end else WriteConsole(ID,'Not given ID.',BAD);
  756.     end;
  757.     if MaskCheck(lowercase(Text),'/ResetStatsID *') then begin
  758.         if (GetPiece(Text,' ',1) <> '') then begin
  759.             try
  760.                 if (GetPlayerStat(strtoint(GetPiece(Text,' ',1)),'Active') = true) then begin
  761.                     if (FileExists('nickreg/'+FilterFilename(GetPlayerStat(strtoint(GetPiece(Text,' ',1)),'name'))+'.txt') = true) then begin
  762.                         ResetPlayerStats(strtoint(GetPiece(Text,' ',1)));
  763.                         WriteConsole(ID,'Restarted player statistics '+GetPlayerStat(strtoint(GetPiece(Text,' ',1)),'Name')+'.',GOOD);
  764.                     end else WriteConsole(ID,'The player does not have an account.',BAD);
  765.                  end else WriteConsole(ID,'None such player.',BAD);
  766.             except WriteConsole(ID,'ID an incorrect.',BAD);
  767.             end;
  768.         end else WriteConsole(ID,'Not given ID.',BAD);
  769.     end;
  770.     if (lowercase(Text) = lowercase('/AdminCommands')) then begin
  771.         WriteConsole(ID,'___Admin Commands:______________________________________',GOOD);
  772.         WriteConsole(ID,'/UpdateStats         - Quick update statistics         |',GOOD);
  773.         WriteConsole(ID,'/ResetRanks          - Restarts ranks                  |',GOOD);
  774.         WriteConsole(ID,'/ResetAllPlayerStats - Restarts all players stats      |',GOOD);
  775.         WriteConsole(ID,'/ResetAllMapStats    - Restarts all maps stats         |',GOOD);
  776.         WriteConsole(ID,'/ResetServerStats    - Restarts the server statistics  |',GOOD);
  777.         WriteConsole(ID,'/ResetMapTop         - Restarts top maps               |',GOOD);
  778.         WriteConsole(ID,'/ReloadSettings      - Reloads settings                |',GOOD);
  779.         WriteConsole(ID,'/ResetStatsID <ID>   - Reset stats player (ID)         |',GOOD);
  780.         WriteConsole(ID,'/DeleteAcc <ID>      - Delete of a player account (ID) |',GOOD);
  781.         WriteConsole(ID,'_______________________________________________________|',GOOD);
  782.     end;
  783.     if (lowercase(Text) = lowercase('/ResetRanks')) then begin
  784.         if (lowercase(EnableTop) = lowercase('ON')) then begin
  785.             RestartRank();
  786.             WriteConsole(0,'Restart ranks!',GOOD);
  787.         end else WriteConsole(0,'Ranks is disabled!',GOOD);
  788.     end;
  789.     if (lowercase(Text) = lowercase('/ResetServerStats')) then begin
  790.         ResetSeverStats();
  791.         WriteConsole(0,'Restart server statistics!',GOOD);
  792.     end;
  793.     if (lowercase(Text) = lowercase('/ResetMapTop')) then begin
  794.         if (lowercase(TopMapsON) = lowercase('ON')) then begin
  795.             ResetMapPlayed();
  796.             WriteConsole(0,'Restart Top Maps!',GOOD);
  797.         end else WriteConsole(0,'Top Maps is disabled!',GOOD);
  798.     end;
  799.     if (lowercase(Text) = lowercase('/ReloadSettings')) then begin
  800.         if LoadSettings('scripts/'+ ScriptName + '/settings.ini') then WriteLn(' [*] '+ ScriptName + ' -> Error while loading settings') else WriteLn(' [*] '+ ScriptName + ' -> Settings loaded successfully');
  801.         WriteConsole(ID,'Settings loaded successfully!',GOOD);
  802.     end;
  803.     Result := false;
  804. end;
  805.  
  806. function OnPlayerCommand(ID: Byte; Text: string): boolean;
  807. var pass, pass2, c: string; temparray: TStringArray;
  808. begin
  809.     if MaskCheck(Text,'/deletemyacc *') then begin
  810.         if (FileExists('nickreg/'+filterFileName(GetPlayerStat(ID,'name'))+'.txt') = true) and (PlayerInfo[ID].DelAcc = 'NO') then begin
  811.             if (PlayerInfo[ID].NickStatus = true) then begin
  812.                 if (PlayerInfo[ID].Password <> '') then begin
  813.                     if (GetPiece(Text,' ',1)<>'') then begin
  814.                         pass := MD5Issue(GetPiece(Text,' ',1));
  815.                         if (pass = PlayerInfo[ID].Password) then begin
  816.                             DeleteInRank(ID);
  817.                             PlayerInfo[id].DelAcc := 'YES';
  818.                             UpdateNickname(ID);
  819.                             PlayerInfo[id].nickStatus := false;
  820.                             WriteConsole(id,' ',GOOD);  WriteConsole(id,' ',GOOD);  WriteConsole(id,' ',GOOD);  WriteConsole(id,' ',GOOD);
  821.                             WriteConsole(id,'                    Your account has been deleted.',BAD);
  822.                             WriteConsole(id,'                           You logged out!        ',BAD);
  823.                             WriteConsole(id,' ',GOOD);  WriteConsole(id,' ',GOOD);  WriteConsole(id,' ',GOOD);
  824.                         end else WriteConsole(ID,'You have entered a wrong password.',BAD);
  825.                     end else WriteConsole(ID,'You must enter a password!',BAD);
  826.                 end else  WriteConsole(ID,'You can`t delete account without password! Type /addpassword <password>',BAD);
  827.             end else WriteConsole(ID,'Please login first!',BAD);
  828.         end else WriteConsole(ID,'Do not have an account.',BAD);
  829.     end;
  830.     if regExpMatch('^/(resetstats|restartstats)$',lowercase(Text)) then begin
  831.         if (lowercase(EnableResetStats) = lowercase('ON')) then begin
  832.             if (PlayerInfo[ID].NickStatus = true) then begin
  833.                 ResetPlayerStats(ID);
  834.                 WriteConsole(ID,'Restarted your stats!',GOOD);
  835.             end else WriteConsole(ID,'Login to restart your stats!',GOOD);
  836.         end else WriteConsole(ID,'Function deactivated by an administrator!',BAD);
  837.     end;
  838.     if MaskCheck(Text,'/create *') then begin
  839.         if (FileExists('nickreg/'+filterFileName(GetPlayerStat(ID,'name'))+'.txt') = false) or (PlayerInfo[ID].DelAcc = 'YES') then begin
  840.             if (PlayerInfo[ID].NickStatus = false) then begin
  841.                 delete(Text,1,8);
  842.                 if (Text <> '') then begin
  843.                     if (regExpMatch(' ',text)=false) then begin
  844.                         if (length(Text) < 17) then begin
  845.                             if (lowercase(AntyMajor) = lowercase('ON')) then if (lowercase(GetPlayerStat(ID,'name')) = lowercase('Major')) then begin
  846.                                 WriteConsole(ID,'Registration for players with nick major have been disable!',BAD);
  847.                                 exit;
  848.                             end else
  849.                             begin
  850.                                 pass := MD5Issue(Text);
  851.                                 SaveNickname(pass,DefaultAutoLogin,ID);
  852.                                 LoadNickname(ID);
  853.                                 WriteConsole(ID,'Nickname ' + GetPlayerStat(ID,'name') + ' successfully registered!',GOOD);
  854.                                 WriteConsole(ID,'Your password is ' + Text + ' - do not forget it!',GOOD);
  855.                                 WriteConsole(ID,'To prove that you really are later, use "/login ' + Text + '" to login.',GOOD);
  856.                                 WriteLn('NickReg: ' + GetPlayerStat(ID,'name') + ' registered from ' + GetPlayerStat(ID,'HWID'));
  857.                                 PlayerInfo[ID].NickStatus := true;
  858.                             end;
  859.                         end else WriteConsole(ID,'Max length password is 16 characters!',BAD);
  860.                     end else WriteConsole(ID,'Your password can not contain spaces.',BAD);
  861.                 end else WriteConsole(ID,'No password found. Please try again.',BAD);
  862.             end else WriteConsole(ID,'You are logged in, please logout and try again.',BAD);
  863.         end else WriteConsole(ID,'You are already a registered user!',BAD);
  864.     end;
  865.     if MaskCheck(Text,'/changepass * *') then begin
  866.         if (FileExists('nickreg/'+filterFileName(GetPlayerStat(ID,'name'))+'.txt') = true) and (PlayerInfo[ID].DelAcc = 'NO') then begin
  867.             if (PlayerInfo[ID].NickStatus = true) then begin
  868.                 if (PlayerInfo[ID].Password<>'') then begin
  869.                     delete(Text,1,12);
  870.                     pass := MD5Issue(GetPiece(Text,' ',0));
  871.                     if (pass = PlayerInfo[ID].Password) then begin
  872.                         delete(Text,1,Length(GetPiece(Text,' ',0))+1);
  873.                         if (regExpMatch(' ',text)=false) then begin
  874.                             if (length(Text) < 17) then begin
  875.                                 pass2 := MD5Issue(Text);
  876.                                 PlayerInfo[ID].Password := pass2;
  877.                                 UpdateNickname(ID);
  878.                                 WriteConsole(ID,'Password changed to: '+Text,GOOD);
  879.                             end else WriteConsole(ID,'Max length password is 16 characters!',BAD);
  880.                         end else WriteConsole(ID,'Your password can not contain spaces.',BAD);
  881.                     end else WriteConsole(ID,'Wrong password!',BAD);
  882.                 end else WriteConsole(ID,'Do not have a password. Type /addpassword <pass>',BAD);
  883.             end else WriteConsole(ID,'Please login first!',BAD);
  884.         end else WriteConsole(ID,'No profile found!',BAD);
  885.     end;
  886.     if MaskCheck(Text,'/changenick * *') then begin
  887.         if (FileExists('nickreg/'+filterFileName(GetPlayerStat(ID,'name'))+'.txt') = true) and (PlayerInfo[ID].DelAcc = 'NO') then begin
  888.             if (PlayerInfo[ID].NickStatus = true) then begin
  889.                 if (PlayerInfo[ID].Password<>'') then begin
  890.                     delete(Text,1,12);
  891.                     pass := MD5Issue(GetPiece(Text,' ',0));
  892.                     delete(Text,1,Length(GetPiece(Text,' ',0))+1);
  893.                     if (PlayerInfo[ID].Password = pass) then begin               
  894.                         if (length(Text) < 25) then begin
  895.                             if (FileExists('nickreg/'+filterFileName(Text)+'.txt') = true) then begin
  896.                                 temparray := Explode(ReadFile('nickreg/'+filterFileName(Text)+'.txt'),CRLF);
  897.                                 c:=temparray[41];
  898.                             end else c:='YES';
  899.                             if (FileExists('nickreg/'+filterFileName(Text)+'.txt') = false) or (c  = 'YES') then begin
  900.                                 if (lowercase(AntyMajor) = lowercase('ON')) then begin
  901.                                     if (lowercase(Text) <> lowercase('Major')) then begin
  902.                                         DeleteInRank(ID);   PlayerInfo[ID].DelAcc := 'YES';     UpdateNickname(ID);
  903.                                         PlayerInfo[ID].Name := Text;        PlayerInfo[ID].DelAcc := 'NO';      UpdateNickname(ID);     PlayerInfo[ID].nickStatus := false;
  904.                                         WriteConsole(ID,'NickName changed to: '+Text,GOOD);
  905.                                         WriteConsole(ID,'Please rejoin the server with your new nick to load your new profile.',GOOD);
  906.                                     end else WriteConsole(ID,'You can not change your nick to Major!',BAD);
  907.                                 end else
  908.                                 begin
  909.                                     DeleteInRank(ID);   PlayerInfo[ID].DelAcc := 'YES';     UpdateNickname(ID);
  910.                                     PlayerInfo[ID].Name :=Text;     PlayerInfo[ID].DelAcc := 'NO';      UpdateNickname(ID);     PlayerInfo[ID].nickStatus := false;
  911.                                     WriteConsole(ID,'NickName changed to: '+Text,GOOD);
  912.                                     WriteConsole(ID,'Please rejoin the server with your new nick to load your new profile.',GOOD);
  913.                                 end;
  914.                             end else WriteConsole(ID,'That nickname is already taken!',BAD);
  915.                         end else WriteConsole(ID,'Nickname is over 24 characters, please pick another.',BAD);
  916.                     end else WriteConsole(ID,'Wrong Password!',BAD);
  917.                 end else WriteConsole(ID,'Do not have a password. Type /addpassword <pass>',BAD);
  918.             end else WriteConsole(ID,'Please login first!',BAD);
  919.         end else WriteConsole(ID,'No profile found!',BAD);
  920.     end;
  921.     if MaskCheck(Text,'/login *') then begin
  922.         if (FileExists('nickreg/'+filterFileName(GetPlayerStat(ID,'name'))+'.txt') = true) and (PlayerInfo[ID].DelAcc = 'NO') then begin
  923.             if (PlayerInfo[ID].NickStatus = false) then begin
  924.                 pass := MD5Issue(GetPiece(Text,' ',1));
  925.                 if (pass = PlayerInfo[ID].Password) then begin
  926.                     PlayerInfo[ID].NickStatus := true;
  927.                     WriteConsole(ID,'You are now logged in!',GOOD);
  928.                     PlayerInfo[ID].startKickTimer := 0;
  929.                     if (lowercase(EnableTop) = lowercase('ON')) then UpdateRanks(ID);
  930.                     UpdateNickname(ID);
  931.                 end else WriteConsole(ID,'Wrong password.',BAD);
  932.             end else WriteConsole(ID,'You are already logged in!',BAD);
  933.         end else WriteConsole(ID,'No profile found!',BAD);
  934.     end;
  935.     if (Text = '/logout') then begin
  936.         if (PlayerInfo[ID].NickStatus = true) then begin
  937.             if (PlayerInfo[ID].Password <> '') then begin
  938.                 PlayerInfo[ID].NickStatus := false;
  939.                 WriteConsole(ID,'You has been logged out!',GOOD);
  940.                 WriteConsole(ID,'Type /login ''password'' to login.',GOOD);
  941.             end else WriteConsole(ID,'You can`t logout without password! Type /addpassword <password>',BAD);
  942.         end else WriteConsole(ID,'Already logged out!',BAD);
  943.     end;
  944.     if MaskCheck(Text,'/autologin *') then begin
  945.         if (FileExists('nickreg/'+filterFileName(GetPlayerStat(ID,'name'))+'.txt') = true) and (PlayerInfo[ID].DelAcc = 'NO') then begin
  946.             if (PlayerInfo[ID].NickStatus = true) then begin
  947.                 case (lowercase(GetPiece(Text,' ',1))) of
  948.                     lowercase('OFF'):   begin
  949.                                             if (PlayerInfo[ID].Password <> '') then begin
  950.                                                 PlayerInfo[ID].Auto := 'OFF';
  951.                                                 WriteConsole(ID,'You have disabled auto login.',GOOD);
  952.                                             end else
  953.                                             begin
  954.                                                 WriteConsole(ID,'Unfortunately you do not have a password, we can not change the autologin.',BAD);
  955.                                                 WriteConsole(ID,'Add a password and can try again. To add please use /addpassword <password>',BAD);
  956.                                             end;
  957.                                         end;
  958.                     lowercase('IP'):    begin
  959.                                             PlayerInfo[ID].Auto := 'IP';
  960.                                             WriteConsole(ID,'AutoLogin changed to: IP',GOOD);
  961.                                         end;
  962.                     lowercase('HWID'):  begin
  963.                                             PlayerInfo[ID].Auto := 'HWID';
  964.                                             WriteConsole(ID,'AutoLogin changed to: HWID',GOOD);
  965.                                         end;
  966.                     lowercase('NICK'):  begin
  967.                                             PlayerInfo[ID].Auto := 'NICK';
  968.                                             WriteConsole(ID,'AutoLogin changed to: NICK',GOOD);
  969.                                             WriteConsole(ID,'Your account is now not protected!',BAD);
  970.                                         end;
  971.                 end;
  972.                 if regExpMatch('^(off|hwid|ip|nick)$',lowercase(GetPiece(Text,' ',1))) then UpdateNickname(ID) else WriteConsole(ID,'Please select the type of AutoLogin: "IP" or "HWID" or "OFF" or "NICK".',BAD);
  973.             end else WriteConsole(ID,'Please login first!',BAD);
  974.         end else WriteConsole(ID,'No profile found!',BAD); //Dominik
  975.     end;
  976.     if MaskCheck(Text,'/addpassword *') then begin
  977.         if (PlayerInfo[ID].NickStatus = true) then begin
  978.             if (PlayerInfo[ID].Password = '') then begin
  979.                 delete(Text,1,13);
  980.                 if (Text <> '') then begin
  981.                     if (regExpMatch(' ',text)=false) then begin
  982.                         pass := MD5Issue(Text);
  983.                         PlayerInfo[ID].Password := pass;
  984.                         UpdateNickname(ID);
  985.                         WriteConsole(ID,'Added password: '+Text+'. Remember this!',GOOD);
  986.                     end else WriteConsole(ID,'Your password can not contain spaces.',BAD);
  987.                 end else WriteConsole(ID,'No password found. Please try again.',BAD);
  988.             end else WriteConsole(ID,'You already have a password, please use to change "/changepass <old_password> <nowe_password>"',BAD);
  989.         end else WriteConsole(ID,'You are not logged in, login or join again.',BAD);
  990.     end;
  991.     if MaskCheck(Text,'/lastplayed *') then begin delete(Text,1,12); LastPlay(ID,text); end;
  992.     Result := false;
  993. end;
  994.  
  995. procedure OnPlayerDeathGiveAssists(Victim: byte);
  996. var i: byte;
  997. begin
  998.     if (lowercase(OtherStatsON) = lowercase('ON')) then begin
  999.         for i := 1 to 32 do if (Victim <> i) and (PlayersInfoArr[Victim].KilledBy <> i) and ((GetplayerStat(Victim,'Team') <> GetplayerStat(i,'Team')) or (GameStyle=0) or (GameStyle=1) or (GameStyle=4) and (GetplayerStat(i,'Active') = true)) then begin
  1000.             if (PlayersInfoArr[Victim].DamageRecievedByCooldown[i] > 0) or (CooldownTimer = 0) then begin
  1001.                 if (PlayersInfoArr[Victim].DamageRecievedByID[i] > AssistMinimumDamagePercent) and (PlayerInfo[i].NickStatus = true) then begin
  1002.                     PlayerStats[i].Asysta := inttostr(strtoint(PlayerStats[i].Asysta) + 1);
  1003.                     if (lowercase(RealTimeUpdate) = lowercase('ON')) then UpdateNickname(i);
  1004.                 end;
  1005.             end;
  1006.         end;
  1007.     end;
  1008. end;
  1009.  
  1010. Procedure RemoveAllDamageToOnDeath(ID:byte);
  1011. var i: byte;
  1012. Begin
  1013.     for i := 1 to 32 do begin
  1014.         PlayersInfoArr[i].DamageRecievedByCooldown[ID] := 0;
  1015.         PlayersInfoArr[i].DamageRecievedByID[33] := PlayersInfoArr[i].DamageRecievedByID[33] + PlayersInfoArr[i].DamageRecievedByID[ID];
  1016.         PlayersInfoArr[i].DamageRecievedByID[ID] := 0;
  1017.     end;
  1018. end;
  1019.  
  1020. Function TotalPercentDamageRecieved(ID:byte): double;
  1021. var i: byte; TotalDamagePercent: double;
  1022. Begin
  1023.     TotalDamagePercent := 0;
  1024.     for i := 1 to 33 do if (PlayersInfoArr[ID].DamageRecievedByID[i] <> 0) then TotalDamagePercent := TotalDamagePercent +  PlayersInfoArr[ID].DamageRecievedByID[i];
  1025.     result := TotalDamagePercent;
  1026. end;
  1027.  
  1028. Function MostPercentDamagedoneBy(ID:byte): integer;
  1029. var i: byte; MostPercentDamagedone: double;
  1030. Begin
  1031.     MostPercentDamagedone := 0;
  1032.     for i := 1 to 33 do if (PlayersInfoArr[ID].DamageRecievedByID[i] > MostPercentDamagedone) then begin
  1033.         MostPercentDamagedone := PlayersInfoArr[ID].DamageRecievedByID[i];
  1034.         result := i;
  1035.     end;
  1036. end;
  1037.  
  1038. Procedure RemoveDamageDoneBy(ID: byte; DamagePercent: Double);
  1039. var i: byte; CountAttackers: integer; DividedDamagePercent: double; DamagePercentLeft: double;
  1040. Begin
  1041.     CountAttackers := 0;
  1042.     for i := 1 to 32 do if (GetPlayerStat(i, 'Active') = true) then if (PlayersInfoArr[ID].DamageRecievedByID[i] <> 0) then inc(CountAttackers,1);
  1043.     if (CountAttackers > 0) then begin
  1044.         DividedDamagePercent := (DamagePercent/CountAttackers);
  1045.         for i := 1 to 33 do if (PlayersInfoArr[ID].DamageRecievedByID[i] <> 0) then begin
  1046.             if ((PlayersInfoArr[ID].DamageRecievedByID[i] - DividedDamagePercent) < 0) then begin          
  1047.                 PlayersInfoArr[ID].DamageRecievedByID[i] := 0;
  1048.                 DamagePercentLeft := (DividedDamagePercent - PlayersInfoArr[ID].DamageRecievedByID[i]);
  1049.             end else PlayersInfoArr[ID].DamageRecievedByID[i] := (PlayersInfoArr[ID].DamageRecievedByID[i] - DividedDamagePercent);
  1050.         end;
  1051.     end;
  1052.     if (DamagePercentLeft <> 0) then RemoveDamageDoneBy(ID,DamagePercentLeft);
  1053. end;
  1054.  
  1055. procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
  1056. var ID, DeathMatchPlayersAliveBeforeThisKill, AlphaPlayersAliveBeforeThisKill,BravoPlayersAliveBeforeThisKill,CharliePlayersAliveBeforeThisKill,DeltaPlayersAliveBeforeThisKill, AliveteamsCountBeforeKill, x: integer;
  1057. begin
  1058.     if (Killer = Victim) then begin
  1059.         if (lowercase(EnableServerStats) = lowercase('ON')) then SSelfkils := inttostr(strtoint(SSelfkils) + 1);
  1060.         if (lowercase(MapStatsON) = lowercase('ON')) then MapSelfkills := inttostr(strtoint(MapSelfkills) + 1);
  1061.         if (lowercase(EnableStats) = lowercase('ON')) then PlayerStats[Victim].SelfKills := inttostr(strtoint(PlayerStats[Victim].SelfKills) + 1);
  1062.     end;
  1063.     if (killer <> victim) then begin
  1064.         if (GetPlayerStat(Killer, 'Active') = true) then begin
  1065.             if (GetPlayerStat(Killer,'team')<>GetPlayerStat(Victim,'team')) then begin
  1066.                 if (lowercase(EnableServerStats) = lowercase('ON')) then SKill := inttostr(strtoint(SKill) + 1);
  1067.                 if (lowercase(MapStatsON) = lowercase('ON')) then MapKills := inttostr(strtoint(MapKills ) + 1);
  1068.                 if (lowercase(EnableStats) = lowercase('ON')) then begin
  1069.                     PlayerStats[Killer].Kills := inttostr(strtoint(PlayerStats[Killer].Kills) + 1);
  1070.                     x := Punkty2(Killer, Victim);
  1071.                     PlayerStats[Killer].Points := inttostr(strtoint(PlayerStats[Killer].Points) + x);
  1072.                     PlayerStats[Victim].Points := inttostr(strtoint(PlayerStats[Victim].Points) - x);
  1073.                     if (GetPlayerStat(Victim,'Flagger')=true) then PlayerStats[Killer].KillFlager := inttostr(strtoint(PlayerStats[Killer].KillFlager)+1);
  1074.                 end;
  1075.             end;
  1076.             if (GameStyle = 0) or (GameStyle = 1) or (GameStyle = 4) then begin
  1077.                 if (lowercase(EnableStats) = lowercase('ON')) then if (GetPlayerStat(Victim,'Flagger')=true) then PlayerStats[Killer].KillFlager := inttostr(strtoint(PlayerStats[Killer].KillFlager)+1);
  1078.                 if (GetPlayerStat(Killer,'alive')=false) and (lowercase(OtherStatsON) = lowercase('ON')) then PlayerStats[Killer].PosKill := inttostr(strtoint(PlayerStats[Killer].PosKill) + 1);
  1079.             end else if (GetPlayerStat(Killer,'team')<>GetPlayerStat(Victim,'team')) then if (GetPlayerStat(Killer,'alive')=false) and (lowercase(OtherStatsON) = lowercase('ON')) then PlayerStats[Killer].PosKill := inttostr(strtoint(PlayerStats[Killer].PosKill) + 1);
  1080.             if (GetPlayerStat(Killer,'team')=GetPlayerStat(Victim,'team')) then begin
  1081.                 if (lowercase(EnableServerStats) = lowercase('ON')) then if(GameStyle = 0) or (GameStyle = 1) or (GameStyle = 4) then SKill := inttostr(strtoint(SKill) + 1) else STeamKill := inttostr(strtoint(STeamKill) + 1);
  1082.                 if (lowercase(MapStatsON) = lowercase('ON')) then if (GameStyle = 0) or (GameStyle = 1) or (GameStyle = 4) then MapKills := inttostr(strtoint(MapKills) + 1) else MapTeamkills := inttostr(strtoint(MapTeamkills) + 1);
  1083.                 if (lowercase(EnableStats) = lowercase('ON')) then begin
  1084.                     if (GameStyle = 1) and (GetPlayerStat(Killer, 'Flagger')) then PlayerStats[Killer].TeamKills := inttostr(strtoint(PlayerStats[Killer].TeamKills) +2) else PlayerStats[Killer].TeamKills := inttostr(strtoint(PlayerStats[Killer].TeamKills) + 1);
  1085.                     if (GameStyle = 0) or (GameStyle = 1) or (GameStyle = 4) then begin
  1086.                         x := Punkty2(Killer, Victim);
  1087.                         PlayerStats[Killer].Points := inttostr(strtoint(PlayerStats[Killer].Points) + x);
  1088.                         PlayerStats[Victim].Points := inttostr(strtoint(PlayerStats[Victim].Points) - x);
  1089.                     end;
  1090.                 end;
  1091.             end;
  1092.         end;
  1093.         if (GetPlayerStat(victim, 'Active') = true) then begin
  1094.             if (lowercase(EnableStats) = lowercase('ON')) then PlayerStats[Victim].Deaths := inttostr(strtoint(PlayerStats[Victim].Deaths) + 1);
  1095.             if (GameStyle = 2) or (GameStyle = 3) or (GameStyle = 5) or (GameStyle = 6) then if (lowercase(EnableStats) = lowercase('ON')) then if (GetPlayerStat(Victim,'Team') = GetPlayerStat(Killer,'Team')) then PlayerStats[Victim].DeathsByTeam := inttostr(strtoint(PlayerStats[Victim].DeathsByTeam) + 1);
  1096.         end;
  1097.         if (lowercase(OtherStatsON) = lowercase('ON')) then begin
  1098.             if (GetPlayerStat(atc[victim], 'Team') = GetPlayerStat(killer, 'Team')) then begin
  1099.                 if (atc[victim] > 0) and (GetPlayerStat(atc[victim], 'Alive') = true) and not (killer = atc[victim]) and (PlayerInfo[killer].NickStatus) then begin
  1100.                     PlayerStats[killer].Wybawiciel := inttostr(strtoint(PlayerStats[killer].Wybawiciel) + 1);
  1101.                     atc[victim] := 0;
  1102.                 end;
  1103.             end;
  1104.             if (Revenge[Killer] = idtoname(victim)) and (PlayerInfo[Killer].NickStatus = true) then begin
  1105.                 PlayerStats[killer].Zemsta := inttostr(strtoint(PlayerStats[killer].Zemsta) + 1);
  1106.                 Revenge[Killer] := '';
  1107.             end;
  1108.             if (Revenge[Victim] = '') then Revenge[Victim] := idtoname(Killer);
  1109.             if (Revenge[Victim] = Revenge[Victim]) then Revenge[Victim] := idtoname(Killer);
  1110.             if (Revenge[Victim] = Revenge[Killer]) then Revenge[Victim] := idtoname(Killer);
  1111.         end;
  1112.     end;
  1113.     RemoveAllDamageToOnDeath(Victim);
  1114.     PlayersInfoArr[Victim].KilledBy := Killer;
  1115.     if (Survival = true) then begin
  1116.         if (DeathmatchPlayers <> 0) and (AlphaPlayers = 0) and (BravoPlayers = 0) and (CharliePlayers = 0) and (DeltaPlayers = 0) then begin
  1117.             DeathMatchPlayersAliveBeforeThisKill := 0;
  1118.             for ID:=1 to 32 do if (GetPlayerStat(ID,'Active') = true) then if ((GetPlayerStat(ID, 'Alive') = true) or (ID = Victim)) then inc(DeathMatchPlayersAliveBeforeThisKill,1);
  1119.             if ((DeathMatchPlayersAliveBeforeThisKill > 1)) then OnPlayerDeathGiveAssists(victim);
  1120.         end else
  1121.         begin
  1122.             for ID:=1 to 32 do if (GetPlayerStat(ID,'Active') = true) then begin
  1123.                 if ((GetPlayerStat(ID, 'Alive') = true) or (ID = Victim)) then begin
  1124.                     case (GetPlayerStat(ID, 'Team')) of
  1125.                         1: AlphaPlayersAliveBeforeThisKill := AlphaPlayersAliveBeforeThisKill + 1;
  1126.                         2: BravoPlayersAliveBeforeThisKill := BravoPlayersAliveBeforeThisKill + 1;
  1127.                         3: CharliePlayersAliveBeforeThisKill := CharliePlayersAliveBeforeThisKill + 1;
  1128.                         4: DeltaPlayersAliveBeforeThisKill := DeltaPlayersAliveBeforeThisKill + 1;
  1129.                     end;
  1130.                 end;
  1131.             end;
  1132.             AliveteamsCountBeforeKill := 0;    
  1133.             if (AlphaPlayersAliveBeforeThisKill > 0) then inc(AliveteamsCountBeforeKill,1);     if (BravoPlayersAliveBeforeThisKill > 0) then inc(AliveteamsCountBeforeKill,1);
  1134.             if (CharliePlayersAliveBeforeThisKill > 0) then inc(AliveteamsCountBeforeKill,1);   if (DeltaPlayersAliveBeforeThisKill > 0) then inc(AliveteamsCountBeforeKill,1);
  1135.             if ((AliveteamsCountBeforeKill > 1)) then OnPlayerDeathGiveAssists(victim);
  1136.         end;
  1137.     end else OnPlayerDeathGiveAssists(victim);
  1138.     if (lowercase(RealTimeUpdate) = lowercase('ON')) then begin
  1139.         UpdateServStats();
  1140.         UpdateMapStats(currentmap);
  1141.         UpdateNickname(Killer);
  1142.         UpdateNickname(Victim);
  1143.         if (lowercase(EnableTop) = lowercase('ON')) then begin
  1144.             if (GetPlayerStat(killer, 'Active') = true) then if (PlayerInfo[killer].NickStatus) then begin
  1145.                 if (GetPlayerStat(killer, 'Human') = true) then UpdateRanks(killer);
  1146.                 SaveRanks();
  1147.             end;
  1148.             if (GetPlayerStat(Victim, 'Active') = true) then if (PlayerInfo[Victim].NickStatus) then begin
  1149.                 if (GetPlayerStat(Victim, 'Human') = true) then UpdateRanks(Victim);
  1150.                 SaveRanks();
  1151.             end;
  1152.         end;
  1153.     end;
  1154. end;
  1155.  
  1156. procedure OnMapChange(NewMap: String);
  1157. var i: byte;
  1158. begin
  1159.     for i := 1 to 32 do if (GetPlayerStat(i, 'Active') = true) then begin
  1160.         Revenge[i] := '';
  1161.         if (lowercase(EnableTop) = lowercase('ON')) then if (PlayerInfo[i].NickStatus = true) then begin
  1162.             if (GetPlayerStat(i, 'Human') = true) then UpdateRanks(i);
  1163.             SaveRanks();
  1164.         end;
  1165.         if (lowercase(RealTimeUpdate) <> lowercase('ON')) then begin
  1166.             UpdateNickname(i);
  1167.             WriteConsole(i,'Stats update!',GOOD);
  1168.         end;
  1169.     end;
  1170.     Go := false;
  1171.     for i := 1 to 32 do Voted[i] := false;
  1172.     VFor := 0; Time := 0;
  1173.     if (lowercase(EnableFlagStats) = lowercase('ON')) then begin
  1174.         INF_BravoNewScore := BravoScore;    HTF_BravoNewScore := BravoScore;    HTF_AlphaNewScore := AlphaScore;
  1175.     end;
  1176.     if (prevmap <> '') then if (lowercase(MapStatsON) = lowercase('ON')) then begin
  1177.         MapPlays := inttostr(strtoint(MapPlays) + 1);
  1178.         UpdateMapStats(prevmap);
  1179.         MapStatsLoad(prevmap);
  1180.         if (lowercase(TopMapsON) = lowercase('ON')) then begin
  1181.             UpdateTopMap();
  1182.             SaveTopMap();
  1183.         end;
  1184.     end;
  1185.     if (lowercase(MapStatsON) = lowercase('ON')) then MapStatsLoad(newmap);
  1186.     PrevMap := newmap;
  1187. end;
  1188.  
  1189. procedure PokazTop(const ID: byte);
  1190. var i, High: integer;
  1191. begin
  1192.     if (lowercase(EnableTop) = lowercase('ON')) then begin
  1193.         if (GetArrayLength(ranks) > 0) then begin
  1194.             if (GetArrayLength(ranks) < TopLines) then high := GetArrayLength(ranks) - 1 else high := TopLines - 1;
  1195.             WriteConsole(iif(lowercase(DisTop) = lowercase('ON'),0,ID), 'Top ' + InttoStr(high + 1) + ' ranked players:', GOOD);
  1196.             for i := 0 to high do WriteConsole(iif(lowercase(DisTop) = lowercase('ON'),0,ID), InttoStr(i + 1) + '. ' + ranks[i].Name + ' - ' + InttoStr(ranks[i].Points) + ' pts.', GOOD);
  1197.         end else WriteConsole(ID, 'No players are ranked yet.', BAD);
  1198.     end else WriteConsole(ID,'Top have been disabled by an administrator.',BAD);
  1199. end;
  1200.  
  1201. procedure PokazTopID(ID: byte; csa: integer);
  1202. var b, High: integer;
  1203. begin
  1204.     if (lowercase(EnableTop) = lowercase('ON')) then begin
  1205.         if (GetArrayLength(ranks) > 0) then begin
  1206.             if (csa<=30) and (csa>0) then begin
  1207.                 if (GetArrayLength(ranks) < csa) then high := GetArrayLength(ranks) - 1 else high := csa - 1;
  1208.                 WriteConsole(iif(lowercase(DisTop) = lowercase('ON'),0,ID), 'Top ' + InttoStr(high + 1) + ' ranked players:', GOOD);
  1209.                 for b := 0 to high do WriteConsole(iif(lowercase(DisTop) = lowercase('ON'),0,ID), InttoStr(b + 1) + '. ' + ranks[b].Name + ' - ' + InttoStr(ranks[b].Points) + ' pts.', GOOD);
  1210.             end else WriteConsole(ID,'The maximum top is 30 players.',BAD);
  1211.         end else WriteConsole(ID, 'No players are ranked yet.', BAD);
  1212.     end else WriteConsole(ID,'Top have been disabled by an administrator.',BAD);
  1213. end;
  1214.  
  1215. procedure RankID(ID: byte; i: integer);
  1216. var b: integer;
  1217. begin
  1218.     if (lowercase(EnableTop) = lowercase('ON')) and (lowercase(EnableRankID) = lowercase('ON')) then begin
  1219.         b:=i; i := i-1;
  1220.         if (GetArrayLength(ranks) > i) and (i >= 0) then WriteConsole(iif(lowercase(DisRankID) = lowercase('ON'),0,ID),'Player '+ranks[i].Name+' is a '+inttostr(b)+' in the ranking of '+InttoStr(ranks[i].Points)+' pts.', GOOD) else WriteConsole(ID,'There is no player in that position in the ranking.',BAD);
  1221.     end else WriteConsole(ID,'!rankid <number> have been disabled by an administrator.',BAD);
  1222. end;
  1223.  
  1224. procedure RankTXT(ID: byte; text: string);
  1225. var b, op: integer; tr: byte;
  1226. begin
  1227.     if (lowercase(EnableTop) = lowercase('ON')) and (lowercase(EnableRank) = lowercase('ON')) then begin
  1228.         if (text = '') then begin
  1229.             if (FileExists('nickreg/'+filterFileName(GetPlayerStat(ID, 'Name'))+'.txt') = true) and (PlayerInfo[ID].DelAcc = 'NO') then begin
  1230.                 if (PlayerInfo[ID].NickStatus = true) then begin
  1231.                     if (strtoint(iif((GameStyle = 2) or (GameStyle = 3) or (GameStyle = 5) or (GameStyle = 6),PlayerStats[ID].Kills, PlayerStats[ID].TeamKills)) >= StrtoInt(LimitKills)) then begin
  1232.                         if (GetArrayLength(ranks) > 0) then for b := 0 to GetArrayLength(ranks) - 1 do if (ranks[b].Name = GetPlayerStat(ID, 'name')) then begin
  1233.                             WriteConsole(iif(lowercase(DisRank) = lowercase('ON'),0,ID),'Player '+GetPlayerStat(ID,'name')+' is a '+InttoStr(b + 1)+' in the ranking of '+PlayerStats[ID].Points+' pts.', GOOD);
  1234.                             exit;
  1235.                         end;
  1236.                     end else WriteConsole(ID,'You must possess a minimum of '+LimitKills+' killings. Have: '+iif((GameStyle = 2) or (GameStyle = 3) or (GameStyle = 5) or (GameStyle = 6),PlayerStats[ID].Kills, PlayerStats[ID].TeamKills),BAD);
  1237.                 end else WriteConsole(ID,'Login to see the stats!',BAD);
  1238.             end else WriteConsole(ID,'Please register! For instructions type: !reginfo',BAD);
  1239.         end else
  1240.         begin
  1241.             op := StrToID(Text);    tr := 0;
  1242.             if (FileExists('nickreg/'+filterFileName(Text)+'.txt') = true) then tr := 1 else if (op = 254) then WriteConsole(ID,'Player not found ('+Text+')',BAD) else if (FileExists('nickreg/'+filterFileName(getPlayerStat(op,'Name'))+'.txt') = true) then tr := 2;
  1243.             if (tr = 1) or (tr = 2) then begin
  1244.                 if (GetArrayLength(ranks) > 0) then for b := 0 to GetArrayLength(ranks) - 1 do if (ranks[b].Name = iif(tr=1,text,getPlayerStat(op,'Name'))) then begin
  1245.                     if (GetArrayLength(ranks) > b) and (b >= 0) then WriteConsole(iif(lowercase(DisRankOther) = lowercase('ON'),0,ID),'Player '+ranks[b].Name+' is a '+inttostr(b+1)+' in the ranking of '+InttoStr(ranks[b].Points)+' pts.', GOOD) else WriteConsole(ID,'There is no player in that position in the ranking.',BAD);
  1246.                 end;
  1247.             end;
  1248.         end;
  1249.     end else WriteConsole(ID,'!rank have been disabled by an administrator.',BAD);
  1250. end;
  1251.  
  1252. procedure PokazTopMaps(const ID: byte);
  1253. var i, High: integer;
  1254. begin
  1255.     if (lowercase(TopMapsON) = lowercase('ON')) and (lowercase(MapStatsON) = lowercase('ON')) then begin
  1256.         if (GetArrayLength(TopMap) > 0) then begin
  1257.             if (GetArrayLength(TopMap) < TopLines) then high := GetArrayLength(TopMap) - 1 else high := TopLines - 1;
  1258.             WriteConsole(iif(lowercase(DisTopMaps) = lowercase('ON'),0,ID), 'Top ' + InttoStr(high + 1) + ' most often played maps:', GOOD);
  1259.             for i := 0 to high do WriteConsole(iif(lowercase(DisTopMaps) = lowercase('ON'),0,ID), InttoStr(i + 1) + '. ' + TopMap[i].Name + ' - ' + InttoStr(TopMap[i].Played) + ' plays.', GOOD);
  1260.         end else WriteConsole(ID, 'No maps in the rankings.', BAD);
  1261.     end else WriteConsole(ID, 'Top maps have been disabled by an administrator.', BAD);
  1262. end;
  1263.  
  1264. Procedure Inne(ID: byte);
  1265. var cel: double;
  1266. begin
  1267.     if (lowercase(OtherStatsON) = lowercase('ON')) then begin
  1268.         if (FileExists('nickreg/'+filterFileName(GetPlayerStat(ID, 'Name'))+'.txt') = true) and (PlayerInfo[ID].DelAcc = 'NO') then begin
  1269.             if (PlayerInfo[ID].NickStatus = true) then begin
  1270.                 if (GameStyle = 2) or (GameStyle = 3) or (GameStyle = 5) or (GameStyle = 6) then begin
  1271.                     if (strtoint(PlayerStats[ID].Kills) >= StrtoInt(LimitKills)) then begin
  1272.                         cel := (single(strtoint(PlayerStats[ID].ShootHit))*100/Single(strtoint(PlayerStats[ID].Shoot)));
  1273.                         if (cel > 100) then cel := 100.00;
  1274.                         WriteConsole(iif(lowercase(DisOtherStats) = lowercase('ON'),0,ID),'Shots: '+PlayerStats[ID].Shoot+', Hits: '+PlayerStats[ID].ShootHit+', Mishit: '+inttostr(strtoint(PlayerStats[ID].Shoot)-strtoint(PlayerStats[ID].ShootHit))+', Accuracy: '+FormatFloat('0.00',cel)+'%',GOOD);
  1275.                         WriteConsole(iif(lowercase(DisOtherStats) = lowercase('ON'),0,ID),iif(FriendlyFire,'Friendly shoots: '+PlayerStats[ID].ShootFriendly+', ','')+'Savior kill: '+PlayerStats[ID].Wybawiciel+', Revenge: '+PlayerStats[ID].Zemsta+', Assist: '+PlayerStats[ID].Asysta+', Posthumous kill: '+PlayerStats[ID].PosKill,GOOD);
  1276.                     end else WriteConsole(ID,'You must possess a minimum of '+LimitKills+' killings. Have: '+PlayerStats[ID].Kills,BAD);
  1277.                 end;
  1278.                 if (GameStyle = 0) or (GameStyle = 1) or (GameStyle = 4) then begin
  1279.                     if (strtoint(PlayerStats[ID].TeamKills) >= StrtoInt(LimitKills)) then begin
  1280.                         cel := (single(strtoint(PlayerStats[ID].ShootHit))*100/Single(strtoint(PlayerStats[ID].Shoot)));
  1281.                         if (cel > 100) then cel := 100.00;
  1282.                         WriteConsole(iif(lowercase(DisOtherStats) = lowercase('ON'),0,ID),'Shots: '+PlayerStats[ID].Shoot+', Hits: '+PlayerStats[ID].ShootHit+', Mishit: '+inttostr(strtoint(PlayerStats[ID].Shoot)-strtoint(PlayerStats[ID].ShootHit))+', Accuracy: '+FormatFloat('0.00',cel)+'%',GOOD);
  1283.                         WriteConsole(iif(lowercase(DisOtherStats) = lowercase('ON'),0,ID),'Savior kill: '+PlayerStats[ID].Wybawiciel+', Revenge: '+PlayerStats[ID].Zemsta+', Assist: '+PlayerStats[ID].Asysta+', Posthumous kill: '+PlayerStats[ID].PosKill,GOOD);
  1284.                     end else WriteConsole(ID,'You must possess a minimum of '+LimitKills+' killings. Have: '+PlayerStats[ID].TeamKills,BAD);
  1285.                 end;
  1286.             end else WriteConsole(ID,'Login to see the stats!',BAD);
  1287.         end else WriteConsole(ID,'Please register! For instructions type: !reginfo',BAD);
  1288.     end else WriteConsole(ID,'Statistics have been disabled by an administrator.',BAD);
  1289. end;
  1290.  
  1291. Procedure InneOther(ID:byte; Text:string);
  1292. var cel: double; op: integer; temparray: TStringArray; fileData: string; tr: byte;
  1293. begin
  1294.     if (lowercase(OtherStatsON) = lowercase('ON')) then begin
  1295.         op := StrToID(Text);    tr := 0;
  1296.         if (FileExists('nickreg/'+filterFileName(Text)+'.txt') = true) then begin
  1297.             filedata := ReadFile('nickreg/'+filterFileName(Text)+'.txt');
  1298.             temparray := Explode(filedata,CRLF);
  1299.             tr := 1;
  1300.         end else
  1301.         begin
  1302.             if (op = 254) then WriteConsole(ID,'Player not found ('+Text+')',BAD) else begin
  1303.                 if (FileExists('nickreg/'+filterFileName(getPlayerStat(op,'Name'))+'.txt') = true) then begin
  1304.                     filedata := ReadFile('nickreg/'+filterFileName(getPlayerStat(op,'Name'))+'.txt');
  1305.                     temparray := Explode(filedata,CRLF);
  1306.                     if (temparray[41] = 'NO') then tr := 2 else WriteConsole(ID,'The player does not have an account.',BAD);
  1307.                 end;
  1308.             end;
  1309.         end;
  1310.         if (tr = 1) or (tr = 2) then begin
  1311.             if (GameStyle = 2) or (GameStyle = 3) or (GameStyle = 5) or (GameStyle = 6) then begin
  1312.                 if (strtoint(temparray[7]) >= StrtoInt(LimitKills)) then begin
  1313.                     cel := (single(strtoint(temparray[23]))*100/Single(strtoint(temparray[22])));
  1314.                     if (cel > 100) then cel := 100.00;
  1315.                     WriteConsole(iif(lowercase(DisStatsOther) = lowercase('ON'),0,ID),'OtherStats player '+iif(tr=1,text,getPlayerStat(op,'Name'))+':',GOOD);
  1316.                     WriteConsole(iif(lowercase(DisOtherOther) = lowercase('ON'),0,ID),'Shots: '+temparray[22]+', Hits: '+temparray[23]+', Mishit: '+inttostr(strtoint(temparray[22])-strtoint(temparray[23]))+', Accuracy: '+FormatFloat('0.00',cel)+'%',GOOD);
  1317.                     WriteConsole(iif(lowercase(DisOtherOther) = lowercase('ON'),0,ID),+iif(FriendlyFire=true,'Friendly shoots: '+temparray[24]+', ','')+'Savior kill: '+temparray[25]+', Revenge: '+temparray[26]+', Assist: '+temparray[27]+', Posthumous kill: '+temparray[5],GOOD);
  1318.                 end else WriteConsole(ID,'The player does not have required number of kills. It has: '+temparray[7]+'/'+LimitKills,BAD);
  1319.             end;
  1320.             if (GameStyle = 0) or (GameStyle = 1) or (GameStyle = 4) then begin
  1321.                 if (strtoint(temparray[8]) >= StrtoInt(LimitKills)) then begin
  1322.                     cel := (single(strtoint(temparray[23]))*100/Single(strtoint(temparray[22])));
  1323.                     if (cel > 100) then cel := 100.00;
  1324.                     WriteConsole(iif(lowercase(DisStatsOther) = lowercase('ON'),0,ID),'OtherStats player '+iif(tr=1,text,getPlayerStat(op,'Name'))+':',GOOD);
  1325.                     WriteConsole(iif(lowercase(DisOtherOther) = lowercase('ON'),0,ID),'Shots: '+temparray[22]+', Hits: '+temparray[23]+', Mishit: '+inttostr(strtoint(temparray[22])-strtoint(temparray[23]))+', Accuracy: '+FormatFloat('0.00',cel)+'%',GOOD);
  1326.                     WriteConsole(iif(lowercase(DisOtherOther) = lowercase('ON'),0,ID),+iif(FriendlyFire=true,'Friendly shoots: '+temparray[24]+', ','')+'Savior kill: '+temparray[25]+', Revenge: '+temparray[26]+', Assist: '+temparray[27]+', Posthumous kill: '+temparray[5],GOOD);
  1327.                 end else WriteConsole(ID,'The player does not have required number of kills. It has: '+temparray[8]+'/'+LimitKills,BAD);
  1328.             end;
  1329.         end;
  1330.     end else WriteConsole(ID,'Statistics have been disabled by an administrator.',BAD);
  1331. end;
  1332.  
  1333. Procedure WinStats(ID: byte);
  1334. var cel: double;
  1335. begin
  1336.     if (lowercase(WinStatsON) = lowercase('ON')) then begin
  1337.         if (FileExists('nickreg/'+filterFileName(GetPlayerStat(ID, 'Name'))+'.txt') = true) and (PlayerInfo[ID].DelAcc = 'NO') then begin
  1338.             if (PlayerInfo[ID].NickStatus = true) then begin
  1339.                 if (strtoint(PlayerStats[ID].Kills) >= StrtoInt(LimitKills)) then begin
  1340.                     cel := (single(strtoint(PlayerStats[ID].ShootHit))*100/Single(strtoint(PlayerStats[ID].Shoot)));
  1341.                     if (cel > 100) then cel := 100.00;
  1342.                     CEL := (Single(strtoint(PlayerStats[ID].Win))/Single(strtoint(PlayerStats[ID].Lose)));
  1343.                     WriteConsole(iif(lowercase(DisWinStats) = lowercase('ON'),0,ID),'Wins: '+PlayerStats[ID].Win+', Lose: '+PlayerStats[ID].Lose+', Draws: '+PlayerStats[ID].Remis+', Win/Lose ratio: '+FormatFloat('0.00',cel),GOOD);
  1344.                     if (GameStyle <> 0) and (GameStyle <> 1) and (GameStyle <> 4) then WriteConsole(iif(lowercase(DisWinStats) = lowercase('ON'),0,ID),'AlphaWin: '+PlayerStats[ID].AlphaWins+', AlphaLose: '+PlayerStats[ID].AlphaLose+', BrawoWin: '+PlayerStats[ID].BravoWins+', BravoLose: '+PlayerStats[ID].BravoLose,GOOD);
  1345.                     if (GameStyle = 2) then WriteConsole(iif(lowercase(DisWinStats) = lowercase('ON'),0,ID),'CharlieWin: '+PlayerStats[ID].CharlieWin+', CharlieLose: '+PlayerStats[ID].CharlieLose+', DeltaWin: '+PlayerStats[ID].DeltaWin+', DeltaLose: '+PlayerStats[ID].DeltaLose,GOOD);
  1346.                 end else WriteConsole(ID,'You must possess a minimum of '+LimitKills+' killings. Have: '+PlayerStats[ID].Kills,BAD);
  1347.             end else WriteConsole(ID,'Login to see the stats!',BAD);
  1348.         end else WriteConsole(ID,'Please register! For instructions type: !reginfo',BAD);
  1349.     end else WriteConsole(ID,'Statistics have been disabled by an administrator.',BAD);
  1350. end;
  1351.  
  1352. Procedure WinStatsOther(ID:byte; Text:string);
  1353. var cel: double; op: integer; temparray: TStringArray; fileData: string; tr: byte;
  1354. begin
  1355.     if (lowercase(WinStatsON) = lowercase('ON')) then begin
  1356.         op := StrToID(Text);    tr := 0;
  1357.         if (FileExists('nickreg/'+filterFileName(Text)+'.txt') = true) then begin
  1358.             filedata := ReadFile('nickreg/'+filterFileName(Text)+'.txt');
  1359.             temparray := Explode(filedata,CRLF);
  1360.             tr := 1;
  1361.         end else
  1362.         begin
  1363.             if (op = 254) then WriteConsole(ID,'Player not found ('+Text+')',BAD) else begin
  1364.                 if (FileExists('nickreg/'+filterFileName(getPlayerStat(op,'Name'))+'.txt') = true) then begin
  1365.                     filedata := ReadFile('nickreg/'+filterFileName(getPlayerStat(op,'Name'))+'.txt');
  1366.                     temparray := Explode(filedata,CRLF);
  1367.                     if (temparray[41] = 'NO') then tr := 2 else WriteConsole(ID,'The player does not have an account.',BAD);
  1368.                 end;
  1369.             end;
  1370.         end;
  1371.         if (tr = 1) or (tr = 2) then begin
  1372.             if (strtoint(iif((GameStyle = 2) or (GameStyle = 3) or (GameStyle = 5) or (GameStyle = 6),temparray[7], temparray[8])) >= StrtoInt(LimitKills)) then begin
  1373.                 cel := (single(strtoint(temparray[23]))*100/Single(strtoint(temparray[22])));
  1374.                 if (cel > 100) then cel := 100.00;
  1375.                 CEL := (Single(strtoint(temparray[28]))/Single(strtoint(temparray[29])));
  1376.                 WriteConsole(iif(lowercase(DisStatsOther) = lowercase('ON'),0,ID),'WinsStats player '+iif(tr=1,text,getPlayerStat(op,'Name'))+':',GOOD);
  1377.                 WriteConsole(iif(lowercase(DisWinStatsOther) = lowercase('ON'),0,ID),'Wins: '+temparray[28]+', Lose: '+temparray[29]+', Draws: '+temparray[30]+', Win/Lose ratio: '+FormatFloat('0.00',cel),GOOD);
  1378.                 if (GameStyle <> 0) and (GameStyle <> 1) and (GameStyle <> 4) then WriteConsole(iif(lowercase(DisWinStatsOther) = lowercase('ON'),0,ID),'AlphaWin: '+temparray[31]+', AlphaLose: '+temparray[32]+', BrawoWin: '+temparray[33]+', BravoLose: '+temparray[34],GOOD);
  1379.                 if(GameStyle = 2) then WriteConsole(iif(lowercase(DisWinStatsOther) = lowercase('ON'),0,ID),'CharlieWin: '+temparray[35]+', CharlieLose: '+temparray[36]+', DeltaWin: '+temparray[37]+', DeltaLose: '+temparray[38],GOOD);
  1380.             end else WriteConsole(ID,'The player does not have required number of kills. It has: '+iif((GameStyle = 2) or (GameStyle = 3) or (GameStyle = 5) or (GameStyle = 6),temparray[7], temparray[8])+'/'+LimitKills,BAD);
  1381.         end;
  1382.     end else WriteConsole(ID,'Statistics have been disabled by an administrator.',BAD);
  1383. end;
  1384.  
  1385. Procedure Stats(ID: byte);
  1386. var i: integer; KD: double;
  1387. begin
  1388.     if (lowercase(EnableStats) = lowercase('ON')) then begin
  1389.         if (FileExists('nickreg/'+filterFileName(GetPlayerStat(ID, 'Name'))+'.txt') = true) and (PlayerInfo[ID].DelAcc = 'NO') then begin
  1390.             if (PlayerInfo[ID].NickStatus = true) then begin
  1391.                 if (GameStyle = 2) or (GameStyle = 3) or (GameStyle = 5) or (GameStyle = 6) then begin
  1392.                     if (strtoint(PlayerStats[ID].Kills) >= StrtoInt(LimitKills)) then begin
  1393.                         if (strtoint(PlayerStats[ID].Kills) <> 0) or (strtoint(PlayerStats[ID].Deaths) <> 0) then begin
  1394.                             if (GetArrayLength(ranks) > 0) then for i := 0 to GetArrayLength(ranks) - 1 do if (ranks[i].Name = GetPlayerStat(ID, 'name')) then begin
  1395.                                 KD := single(strtoint(PlayerStats[ID].Kills)) / single(strtoint(PlayerStats[ID].Deaths));
  1396.                                 WriteConsole(iif(lowercase(DisStats) = lowercase('ON'),0,ID), 'Rank: ' + InttoStr(i + 1) + '/' + InttoStr(GetArrayLength(ranks)) + ', Points: '+PlayerStats[ID].Points+', K/D: '+FormatFloat('0.00',KD)+', PlayerRate: '+inttostr(Punkty(ID)), GOOD);
  1397.                                 WriteConsole(iif(lowercase(DisStats) = lowercase('ON'),0,ID),'Kills: '+PlayerStats[ID].Kills+', Death: '+PlayerStats[ID].Deaths+', Selfkills: '+PlayerStats[ID].SelfKills,GOOD);
  1398.                                 if (FriendlyFire) then WriteConsole(iif(lowercase(DisStats) = lowercase('ON'),0,ID),'Teamkills: '+PlayerStats[ID].TeamKills+', Killed By Friend: '+PlayerStats[ID].DeathsByTeam,GOOD);
  1399.                                 exit;
  1400.                             end;
  1401.                         end else WriteConsole(ID,'We are sorry for the moment we have too little information about you.',BAD);
  1402.                     end else WriteConsole(ID,'You must possess a minimum of '+LimitKills+' killings. Have: '+PlayerStats[ID].Kills,BAD);
  1403.                 end;
  1404.                 if (GameStyle = 0) or (GameStyle = 1) or (GameStyle = 4) then begin
  1405.                     if (strtoint(PlayerStats[ID].TeamKills) >= StrtoInt(LimitKills)) then begin
  1406.                         if (strtoint(PlayerStats[ID].TeamKills) <> 0) or (strtoint(PlayerStats[ID].Deaths) <> 0) then begin
  1407.                             if (GetArrayLength(ranks) > 0) then for i := 0 to GetArrayLength(ranks) - 1 do
  1408.                                 if (ranks[i].Name = GetPlayerStat(ID, 'name')) then begin
  1409.                                     KD := single(strtoint(PlayerStats[ID].TeamKills)) / single(strtoint(PlayerStats[ID].Deaths));
  1410.                                     WriteConsole(iif(lowercase(DisStats) = lowercase('ON'),0,ID), 'Rank: ' + InttoStr(i + 1) + '/' + InttoStr(GetArrayLength(ranks)) + ', Points: '+PlayerStats[ID].Points+', K/D: '+FormatFloat('0.00',KD)+', PlayerRate: '+inttostr(Punkty(ID)), GOOD);
  1411.                                     WriteConsole(iif(lowercase(DisStats) = lowercase('ON'),0,ID),'Kills: '+PlayerStats[ID].TeamKills+', Death: '+PlayerStats[ID].Deaths+', Selfkills: '+PlayerStats[ID].SelfKills,GOOD);
  1412.                                 exit;
  1413.                             end;
  1414.                         end else WriteConsole(ID,'We are sorry for the moment we have too little information about you.',BAD);
  1415.                     end else WriteConsole(ID,'You must possess a minimum of '+LimitKills+' killings. Have: '+PlayerStats[ID].TeamKills,BAD);
  1416.                 end;
  1417.             end else WriteConsole(ID,'Login to see the stats!',BAD);
  1418.         end else WriteConsole(ID,'Please register! For instructions type: !reginfo',BAD);
  1419.     end else WriteConsole(ID,'Statistics have been disabled by an administrator.',BAD);
  1420. end;
  1421.  
  1422. Procedure StatsOther(ID:byte; Text:string);
  1423. var op, i: integer; temparray: TStringArray; fileData: string; tr: byte; KD: double;
  1424. begin
  1425.     if (lowercase(EnableStats) = lowercase('ON')) then begin
  1426.         op := StrToID(Text);    tr := 0;
  1427.         if (FileExists('nickreg/'+filterFileName(Text)+'.txt') = true) then begin
  1428.             filedata := ReadFile('nickreg/'+filterFileName(Text)+'.txt');
  1429.             temparray := Explode(filedata,CRLF);
  1430.             tr := 1;
  1431.         end else
  1432.         begin
  1433.             if (op = 254) then WriteConsole(ID,'Player not found ('+Text+')',BAD) else begin
  1434.                 if (FileExists('nickreg/'+filterFileName(getPlayerStat(op,'Name'))+'.txt') = true) then begin
  1435.                     filedata := ReadFile('nickreg/'+filterFileName(getPlayerStat(op,'Name'))+'.txt');
  1436.                     temparray := Explode(filedata,CRLF);
  1437.                     if (temparray[41] = 'NO') then tr := 2 else WriteConsole(ID,'The player does not have an account.',BAD);
  1438.                 end;
  1439.             end;
  1440.         end;
  1441.         if (tr = 1) or (tr = 2) then begin
  1442.             if (GameStyle = 2) or (GameStyle = 3) or (GameStyle = 5) or (GameStyle = 6) then begin
  1443.                 if (strtoint(temparray[7]) >= StrtoInt(LimitKills)) then begin
  1444.                     if (strtoint(temparray[7]) = 0) or (strtoint(temparray[9]) <> 0) then begin
  1445.                         if (GetArrayLength(ranks) > 0) then for i := 0 to GetArrayLength(ranks) - 1 do if (ranks[i].Name = temparray[0]) then begin
  1446.                             WriteConsole(iif(lowercase(DisStatsOther) = lowercase('ON'),0,ID),'Player statistics '+iif(tr=1,text,getPlayerStat(op,'Name'))+':',GOOD);
  1447.                             KD := single(strtoint(temparray[7])) / single(strtoint(temparray[9]));
  1448.                             WriteConsole(iif(lowercase(DisStatsOther) = lowercase('ON'),0,ID), 'Rank: ' + InttoStr(i + 1) + '/' + InttoStr(GetArrayLength(ranks)) + ', Points: '+temparray[39], GOOD);
  1449.                             WriteConsole(iif(lowercase(DisStatsOther) = lowercase('ON'),0,ID),'Kills: '+temparray[7]+', Death: '+temparray[9]+', Selfkills: '+temparray[11]+', K/D: '+FormatFloat('0.00',KD),GOOD);
  1450.                             if (FriendlyFire) then WriteConsole(iif(lowercase(DisStatsOther) = lowercase('ON'),0,ID),'Teamkills: '+temparray[8]+', Killed By Friend: '+temparray[10],GOOD);
  1451.                             exit;
  1452.                         end;
  1453.                     end else WriteConsole(ID,'Have too enough information about this player.',BAD);
  1454.                 end else WriteConsole(ID,'The player does not have required number of kills. It has: '+temparray[7]+'/'+LimitKills,BAD);
  1455.             end;
  1456.             if (GameStyle = 0) or (GameStyle = 1) or (GameStyle = 4) then begin
  1457.                 if (strtoint(temparray[8]) >= StrtoInt(LimitKills)) then begin
  1458.                     if (strtoint(temparray[8]) <> 0) or (strtoint(temparray[9]) <> 0) then begin
  1459.                         if (GetArrayLength(ranks) > 0) then for i := 0 to GetArrayLength(ranks) - 1 do
  1460.                             if (ranks[i].Name = temparray[0]) then begin
  1461.                                 WriteConsole(iif(lowercase(DisStatsOther) = lowercase('ON'),0,ID),'Player statistics '+iif(tr=1,Text,getPlayerStat(op,'Name'))+':',GOOD);
  1462.                                 KD := single(strtoint(temparray[8])) / single(strtoint(temparray[9]));
  1463.                                 WriteConsole(iif(lowercase(DisStatsOther) = lowercase('ON'),0,ID), 'Rank: ' + InttoStr(i + 1) + '/' + InttoStr(GetArrayLength(ranks)) + ', Points: '+temparray[39], GOOD);
  1464.                                 WriteConsole(iif(lowercase(DisStatsOther) = lowercase('ON'),0,ID),'Kills: '+temparray[8]+', Death: '+temparray[9]+', Selfkills: '+temparray[11]+', K/D: '+FormatFloat('0.00',KD),GOOD);
  1465.                             exit;
  1466.                         end;
  1467.                     end else WriteConsole(ID,'Have too enough information about this player.',BAD);
  1468.                 end else WriteConsole(ID,'The player does not have required number of kills. It has: '+temparray[8]+'/'+LimitKills,BAD);
  1469.             end;
  1470.         end;
  1471.     end else WriteConsole(ID,'Statistics have been disabled by an administrator.',BAD);
  1472. end;
  1473.  
  1474. Procedure FlagStats(ID: byte);
  1475. begin
  1476.     if (lowercase(EnableFlagStats) = lowercase('ON')) then begin
  1477.         if (FileExists('nickreg/'+filterFileName(GetPlayerStat(ID, 'Name'))+'.txt') = true) and (PlayerInfo[ID].DelAcc = 'NO') then begin
  1478.             if (PlayerInfo[ID].NickStatus = true) then begin
  1479.                 if (GameStyle = 1) then if (strtoint(PlayerStats[ID].TeamKills) >= StrtoInt(LimitKills)) then WriteConsole(iif(lowercase(DisFlagStats) = lowercase('ON'),0,ID),'Flag Grabs: '+PlayerStats[ID].FlagGrab+', Flag Drop: '+PlayerStats[ID].FlagDrop+', Kill Flager: '+PlayerStats[ID].KillFlager, GOOD) else WriteConsole(ID,'You must possess a minimum of '+LimitKills+' killings. Have: '+PlayerStats[ID].TeamKills,BAD);
  1480.                 if (strtoint(PlayerStats[ID].Kills) >= StrtoInt(LimitKills)) then begin
  1481.                     if (GameStyle = 3) then begin
  1482.                         WriteConsole(iif(lowercase(DisFlagStats) = lowercase('ON'),0,ID),'Flag Grabs: '+PlayerStats[ID].FlagGrab+', Flag Return: '+PlayerStats[ID].FlagReturn+', Flag Score: '+PlayerStats[ID].FlagScore+', Flag Drop: '+PlayerStats[ID].FlagDrop, GOOD);
  1483.                         WriteConsole(iif(lowercase(DisFlagStats) = lowercase('ON'),0,ID),'Alpha Caps: '+PlayerStats[ID].AlphaCaps+', Bravo Caps: '+PlayerStats[ID].BravoCaps+', Kill Flager: '+PlayerStats[ID].KillFlager, GOOD);
  1484.                     end;
  1485.                     if (GameStyle = 5) then begin
  1486.                         WriteConsole(iif(lowercase(DisFlagStats) = lowercase('ON'),0,ID),'Flag Grabs: '+PlayerStats[ID].FlagGrab+', Flag Return: '+PlayerStats[ID].FlagReturn+', Flag Drop: '+PlayerStats[ID].FlagDrop, GOOD);
  1487.                         WriteConsole(iif(lowercase(DisFlagStats) = lowercase('ON'),0,ID),'Alpha Caps: '+PlayerStats[ID].AlphaCaps+' Bravo Points: '+PlayerStats[ID].INF_Blue+' Alpha Points: '+PlayerStats[ID].INF_Red+', Kill Flager: '+PlayerStats[ID].KillFlager, GOOD);
  1488.                     end;
  1489.                     if (GameStyle = 6) then begin
  1490.                         WriteConsole(iif(lowercase(DisFlagStats) = lowercase('ON'),0,ID),'Flag Grabs: '+PlayerStats[ID].FlagGrab+', Flag Drop: '+PlayerStats[ID].FlagDrop, GOOD);
  1491.                         WriteConsole(iif(lowercase(DisFlagStats) = lowercase('ON'),0,ID),'Alpha Points: '+PlayerStats[ID].HTF_Red+' Bravo Points: '+PlayerStats[ID].HTF_Blue+', Kill Flager: '+PlayerStats[ID].KillFlager, GOOD);
  1492.                     end;
  1493.                 end else WriteConsole(ID,'You must possess a minimum of '+LimitKills+' killings. Have: '+PlayerStats[ID].Kills,BAD);
  1494.             end else WriteConsole(ID,'Login to see the flag stats!',BAD);
  1495.         end else WriteConsole(ID,'Please register! For instructions type: !reginfo',BAD);
  1496.         if (GameStyle = 0) then WriteConsole(ID,'It is not available in a deathmatch mode.',BAD);
  1497.         if (GameStyle = 2) then WriteConsole(ID,'It is not available in a TDM mode.',BAD);
  1498.         if (GameStyle = 4) then WriteConsole(ID,'It is not available in a rambo mode.',BAD);
  1499.     end else WriteConsole(ID,'Statistics have been disabled by an administrator.',BAD);
  1500. end;
  1501.  
  1502. Procedure FlagStatsOther(ID: byte; Text:string);
  1503. var op: integer; temparray: TStringArray; fileData: string; tr: byte;
  1504. begin
  1505.     if (GameStyle=0) or (GameStyle=2) or (GameStyle=4) then begin
  1506.         if (GameStyle = 0) then WriteConsole(ID,'It is not available in a mode deathmatch.',BAD);
  1507.         if (GameStyle = 2) then WriteConsole(ID,'It is not available in a mode TDM.',BAD);
  1508.         if (GameStyle = 4) then WriteConsole(ID,'It is not available in a rambo mode.',BAD);
  1509.         exit;
  1510.     end;
  1511.     if (lowercase(EnableFlagStats) = lowercase('ON')) then begin
  1512.         op := StrToID(Text);    tr := 0;
  1513.         if (FileExists('nickreg/'+filterFileName(Text)+'.txt') = true) then begin
  1514.             filedata := ReadFile('nickreg/'+filterFileName(Text)+'.txt');
  1515.             temparray := Explode(filedata,CRLF);
  1516.             tr := 1;
  1517.         end else
  1518.         begin
  1519.             if (op = 254) then WriteConsole(ID,'Player not found ('+Text+')',BAD) else begin
  1520.                 if (FileExists('nickreg/'+filterFileName(getPlayerStat(op,'Name'))+'.txt') = true) then begin
  1521.                     filedata := ReadFile('nickreg/'+filterFileName(getPlayerStat(op,'Name'))+'.txt');
  1522.                     temparray := Explode(filedata,CRLF);
  1523.                     if (temparray[41] = 'NO') then tr := 2 else WriteConsole(ID,'The player does not have an account.',BAD);
  1524.                 end;
  1525.             end;
  1526.         end;
  1527.         if (tr = 1) or (tr = 2) then begin
  1528.             if (strtoint(iif((GameStyle = 2) or (GameStyle = 3) or (GameStyle = 5) or (GameStyle = 6),temparray[7], temparray[8])) >= StrtoInt(LimitKills)) then begin
  1529.                 if (GameStyle = 1) then begin
  1530.                     WriteConsole(iif(lowercase(DisFlagStatsOther) = lowercase('ON'),0,ID),'Player flag statistics '+iif(tr=1,Text,getPlayerStat(op,'Name'))+':',GOOD);
  1531.                     WriteConsole(iif(lowercase(DisFlagStatsOther) = lowercase('ON'),0,ID),'Flag Grabs: '+temparray[12]+', Flag Drop: '+temparray[15]+', Kill Flager: '+temparray[40], GOOD);
  1532.                 end;
  1533.                 if (GameStyle = 3) then begin
  1534.                     WriteConsole(iif(lowercase(DisFlagStatsOther) = lowercase('ON'),0,ID),'Player flag statistics '++iif(tr=1,text,getPlayerStat(op,'Name'))++':',GOOD);
  1535.                     WriteConsole(iif(lowercase(DisFlagStatsOther) = lowercase('ON'),0,ID),'Flag Grabs: '+temparray[12]+', Flag Return: '+temparray[13]+', Flag Score: '+temparray[14]+', Flag Drop: '+temparray[15], GOOD);
  1536.                     WriteConsole(iif(lowercase(DisFlagStatsOther) = lowercase('ON'),0,ID),'Alpha Caps: '+temparray[16]+', Bravo Caps: '+temparray[17]+', Kill Flager: '+temparray[40], GOOD);              
  1537.                 end;
  1538.                 if (GameStyle = 5) then begin
  1539.                     WriteConsole(iif(lowercase(DisFlagStatsOther) = lowercase('ON'),0,ID),'Player flag statistics '+iif(tr=1,Text,getPlayerStat(op,'Name'))+':',GOOD);
  1540.                     WriteConsole(iif(lowercase(DisFlagStatsOther) = lowercase('ON'),0,ID),'Flag Grabs: '+temparray[12]+', Flag Return: '+temparray[13]+', Flag Drop: '+temparray[15], GOOD);
  1541.                     WriteConsole(iif(lowercase(DisFlagStatsOther) = lowercase('ON'),0,ID),'Alpha Caps: '+temparray[16]+' Bravo Points: '+temparray[19]+' Alpha Points: '+temparray[18]+', Kill Flager: '+temparray[40], GOOD);
  1542.                 end;
  1543.                 if (GameStyle = 6) then begin
  1544.                     WriteConsole(iif(lowercase(DisFlagStatsOther) = lowercase('ON'),0,ID),'Player flag statistics '+iif(tr=1,Text,getPlayerStat(op,'Name'))+':',GOOD);
  1545.                     WriteConsole(iif(lowercase(DisFlagStatsOther) = lowercase('ON'),0,ID),'Flag Grabs: '+temparray[12]+', Flag Return: '+temparray[13]+', Flag Drop: '+temparray[15], GOOD);
  1546.                     WriteConsole(iif(lowercase(DisFlagStatsOther) = lowercase('ON'),0,ID),'Alpha Points: '+temparray[20]+' Bravo Points: '+temparray[21]+', Kill Flager: '+temparray[40], GOOD);
  1547.                 end;
  1548.             end else WriteConsole(ID,'The player does not have required number of kills. It has: '+iif((GameStyle = 2) or (GameStyle = 3) or (GameStyle = 5) or (GameStyle = 6),temparray[7], temparray[8])+'/'+LimitKills,BAD);
  1549.         end;
  1550.     end else WriteConsole(ID,'Statistics have been disabled by an administrator.',BAD);
  1551. end;
  1552.  
  1553. Procedure ServerStats(ID: byte);
  1554. begin
  1555.     if (lowercase(EnableServerStats) = lowercase('ON')) then begin
  1556.         WriteConsole(iif(lowercase(DisServerStats) = lowercase('ON'),0,ID),'Server Visit: '+Visit+', Server Kills: '+SKill+', Server Selfkills: '+SSelfkils+iif(FriendlyFire,', Team Kills: '+STeamKill,''),GOOD);
  1557.         WriteConsole(iif(lowercase(DisServerStats) = lowercase('ON'),0,ID),'Joins Alpha: '+AlphaV+', Joins Bravo: '+BlueV+', Joins Spec: '+SpecV+iif(GameStyle<>2,', Kick of Game: '+SKick,''), GOOD);
  1558.         if (GameStyle = 2) then WriteConsole(iif(lowercase(DisServerStats) = lowercase('ON'),0,ID),'Joins Charle: '+CharlieV+', Joins Delta: '+DeltaV+', Kick of Game: '+SKick, GOOD);
  1559.     end else WriteConsole(ID,'Statistics have been disabled by an administrator.',BAD);
  1560. end;
  1561.  
  1562. Procedure DisplayMapStats(ID: byte);
  1563. begin
  1564.     if (lowercase(MapStatsON) = lowercase('ON')) then begin
  1565.         if (FileExists('nickreg/maps/'+currentmap+'.txt') = true) then begin
  1566.             WriteConsole(iif(lowercase(DisMapStats) = lowercase('ON'),0,ID),'Maps Statistics: '+currentmap, GOOD);
  1567.             if (GameStyle = 3) or (GameStyle = 5) then WriteConsole(iif(lowercase(DisMapStats) = lowercase('ON'),0,ID),'Flag Caps: '+MapFlagCaps+', Flag Grabs: '+MapFlagGrabs+', Flag Returns: '+MapFlagReturns+', Flag Drop: '+MapFlagDrop, GOOD);
  1568.             if (GameStyle = 6) or (GameStyle = 1) then WriteConsole(iif(lowercase(DisMapStats) = lowercase('ON'),0,ID),'Flag Grabs: '+MapFlagGrabs+', Flag Drop: '+MapFlagDrop, GOOD);
  1569.             WriteConsole(iif(lowercase(DisMapStats) = lowercase('ON'),0,ID),'Games played: '+MapPlays+', Players Joined: '+MapPlayerJoins+', Players Left: '+MapPlayerLeaves+', Players Kicked: '+MapPlayerKicks, GOOD);
  1570.             WriteConsole(iif(lowercase(DisMapStats) = lowercase('ON'),0,ID),'Kills: '+MapKills+', Selfkills: '+MapSelfkills+iif((GameStyle=0) or (GameStyle=1) or (GameStyle=4),'',iif(friendlyfire,', Teamkills: '+MapTeamkills,'')), GOOD);
  1571.         end;
  1572.     end else WriteConsole(ID,'Statistics maps have been disabled by an administrator.', BAD);
  1573. end;
  1574.  
  1575. Procedure DisplayMapStatsMAP(ID: byte; Text: string);
  1576. var temparray: TStringArray; fileData: string;
  1577. begin
  1578.     if (lowercase(MapStatsON) = lowercase('ON')) then begin
  1579.         if (FileExists('nickreg/maps/'+Text+'.txt') = true) then begin
  1580.             filedata := ReadFile('nickreg/maps/'+Text+'.txt');
  1581.             temparray := Explode(filedata,CRLF);
  1582.             WriteConsole(iif(lowercase(DisMapStats) = lowercase('ON'),0,ID),'Maps Statistics: '+Text, GOOD);
  1583.             if (GameStyle = 3) or (GameStyle = 5) or (GameStyle = 6) then WriteConsole(iif(lowercase(DisMapStats) = lowercase('ON'),0,ID),'Flag Caps: '+temparray[3]+', Flag Grabs: '+temparray[4]+', Flag Returns: '+temparray[5]+', Flag Drop: '+temparray[6], GOOD);
  1584.             WriteConsole(iif(lowercase(DisMapStats) = lowercase('ON'),0,ID),'Games played: '+temparray[7]+', Players Joined: '+temparray[8]+', Players Left: '+temparray[9]+', Players Kicked: '+temparray[10], GOOD);
  1585.             WriteConsole(iif(lowercase(DisMapStats) = lowercase('ON'),0,ID),'Kills: '+temparray[0]+', Selfkills: '+temparray[1]+iif((GameStyle=0) or (GameStyle=1) or (GameStyle=4),'',iif(friendlyfire,', Teamkills: '+temparray[2],'')), GOOD);
  1586.         end else WriteConsole(ID,'Not found statistics map: '+Text, BAD);
  1587.     end else WriteConsole(ID,'Statistics maps have been disabled by an administrator.', BAD);
  1588. end;
  1589.  
  1590. Procedure VoteUpdate(ID: byte);
  1591. var i: integer; KD: double;
  1592. begin
  1593.     if (lowercase(EnableVoteUpdate) = lowercase('ON')) then begin
  1594.         if (Voted[ID] = false) then begin
  1595.             if (Go = false) then Time := InitTime else Time := (Time + AddTime);
  1596.             Go := true;     Voted[ID] := true;      VFor := VFor + 1;
  1597.             KD := single(100 * VFor) / single(NumPlayers-NumBots);
  1598.             if (KD >= Procent) then begin
  1599.                 Go := false;
  1600.                 for i := 1 to 32 do Voted[i] := false;
  1601.                 VFor := 0;      Time := 0;
  1602.                 WriteConsole(0,'Voting for updating statistics, passed.', GOOD);
  1603.                 WriteConsole(0,'Stats update!',GOOD);
  1604.                 UpdateServStats();
  1605.                 for i := 1 to 32 do if (GetPlayerStat(i, 'Active') = true) then begin
  1606.                     UpdateNickname(i);
  1607.                     if (lowercase(EnableTop) = lowercase('ON')) then if (GetPlayerStat(i, 'Active') = true) then if (GetPlayerStat(i, 'Human') = true) then UpdateRanks(i);
  1608.                     SaveRanks();
  1609.                 end;
  1610.             end else
  1611.             begin
  1612.                 KD := single(100 * VFor) / single(NumPlayers-NumBots);
  1613.                 WriteConsole(0,FormatFloat('0.00',KD)+ '% / ' + InttoStr(Procent) + '% required for a vote pass', GOOD);
  1614.             end;
  1615.         end else WriteConsole(ID,'You have already voted.',BAD);
  1616.     end else WriteConsole(ID,'Function deactivated by an administrator!',BAD);
  1617. end;
  1618.  
  1619. procedure AutoLogin(ID: byte);
  1620. begin
  1621.     if (length(getPlayerStat(ID, 'name' )) > 24) then begin
  1622.         WriteConsole(ID,'...your name is over 24 characters, please change it.',BAD);
  1623.         KickPlayer(ID);     Exit;
  1624.     end;
  1625.     LoadNickname(ID);
  1626.     case (lowercase(PlayerInfo[ID].Auto)) of
  1627.         lowercase('HWID'):  begin
  1628.                                 if (getPlayerStat(ID,'HWID') = PlayerInfo[ID].HWID) then begin
  1629.                                     PlayerInfo[ID].NickStatus := true;
  1630.                                     WriteConsole(ID,'Automatic login through HWID - Completed successfully!', GOOD);
  1631.                                     WriteConsole(ID,'Welcome back '+GetPlayerStat(ID,'name')+' (HWID: '+GetPlayerStat(ID,'HWID')+')',GOOD);
  1632.                                     if (PlayerInfo[ID].Password = '') then WriteConsole(ID,'To better protect account please add password /addpassword <password>',BAD);
  1633.                                 end else
  1634.                                 begin
  1635.                                     WriteConsole(ID,'Automatic login through HWID - The unsuccessful!', BAD);
  1636.                                     WriteConsole(ID,'The nickname '+GetPlayerStat(ID,'name')+' is REGISTERED!',BAD);
  1637.                                     if (lowercase(KickTimeON) = lowercase('ON')) then begin
  1638.                                         WriteConsole(ID,'Use "/login password" to login or you will be kicked in '+inttostr(KickTime)+' seconds', BAD);
  1639.                                         PlayerInfo[ID].startKickTimer:= 1;  PlayerInfo[ID].kickTimer := KickTime;
  1640.                                     end else WriteConsole(ID,'Use "/login password" to login, otherwise you will not be charged your statistics!', BAD);
  1641.                                 end;
  1642.                             end;
  1643.         lowercase('IP'):    begin
  1644.                                 if (getPlayerStat(ID,'IP') = PlayerInfo[ID].IP) then begin
  1645.                                     PlayerInfo[ID].NickStatus := true;
  1646.                                     WriteConsole(ID,'Automatic login through IP - Completed successfully!', GOOD);
  1647.                                     WriteConsole(ID,'Welcome back '+GetPlayerStat(ID,'name')+' (IP: '+GetPlayerStat(ID,'ip')+')',GOOD);
  1648.                                     if (PlayerInfo[ID].Password = '') then WriteConsole(ID,'To better protect account please add password /addpassword <password>',BAD);
  1649.                                 end else
  1650.                                 begin
  1651.                                     WriteConsole(ID,'Automatic login through IP - The unsuccessful!', BAD);
  1652.                                     WriteConsole(ID,'The nickname '+GetPlayerStat(ID,'name')+' is REGISTERED!',BAD);
  1653.                                     if (lowercase(KickTimeON) = lowercase('ON')) then begin
  1654.                                         WriteConsole(ID,'Use "/login password" to login or you will be kicked in '+inttostr(KickTime)+' seconds', BAD);
  1655.                                         PlayerInfo[ID].startKickTimer := 1; PlayerInfo[ID].kickTimer := KickTime;
  1656.                                     end else WriteConsole(ID,'Use "/login password" to login, otherwise you will not be charged your statistics!', BAD);
  1657.                                 end;
  1658.                             end;
  1659.         lowercase('NICK'):  begin
  1660.                                 if (getPlayerStat(ID, 'name' ) = PlayerInfo[ID].Name) then begin
  1661.                                     PlayerInfo[ID].NickStatus := true;
  1662.                                     WriteConsole(ID,'Automatic login through nick - Completed successfully!', GOOD);
  1663.                                     WriteConsole(ID,'Welcome back '+GetPlayerStat(ID,'name')+' (Nick: '+GetPlayerStat(ID,'name')+')',GOOD);
  1664.                                     if (PlayerInfo[ID].Password = '') then WriteConsole(ID,'To better protect account please add password /addpassword <password>',BAD);
  1665.                                 end else
  1666.                                 begin
  1667.                                     WriteConsole(ID,'Automatic login through nick - The unsuccessful!', BAD);
  1668.                                     WriteConsole(ID,'The nickname '+GetPlayerStat(ID,'name')+' is REGISTERED!',BAD);
  1669.                                     if (lowercase(KickTimeON) = lowercase('ON')) then begin
  1670.                                         WriteConsole(ID,'Use "/login password" to login or you will be kicked in '+inttostr(KickTime)+' seconds', BAD);
  1671.                                         PlayerInfo[ID].startKickTimer := 1; PlayerInfo[ID].kickTimer := KickTime;
  1672.                                     end else WriteConsole(ID,'Use "/login password" to login, otherwise you will not be charged your statistics!', BAD);
  1673.                                 end;
  1674.                             end;
  1675.         lowercase('OFF'):   begin
  1676.                                 WriteConsole(ID,'Autologin disabled, please login!', BAD);
  1677.                                 WriteConsole(ID,'The nickname '+GetPlayerStat(ID,'name')+' is REGISTERED!',BAD);
  1678.                                 if (lowercase(KickTimeON) = lowercase('ON')) then begin
  1679.                                     WriteConsole(ID,'Use "/login password" to login or you will be kicked in '+inttostr(KickTime)+' seconds', BAD);
  1680.                                     PlayerInfo[ID].startKickTimer := 1;     PlayerInfo[ID].kickTimer := KickTime;
  1681.                                 end else WriteConsole(ID,'Use "/login password" to login, otherwise you will not be charged your statistics!', BAD);
  1682.                             end;
  1683.     end;
  1684.     if (PlayerInfo[ID].NickStatus) then begin
  1685.         if (GetPlayerStat(ID,'Human') = true) then UpdateRanks(ID);
  1686.         SaveRanks();
  1687.     end;
  1688. end;
  1689.  
  1690. procedure Informacje(ID: byte; Text:String);
  1691. var gracze: TStringArray;
  1692. begin
  1693.     if regExpMatch('^!(reginfo)$',lowercase(Text)) then begin
  1694.             WriteConsole(ID,'____Registration Commands _______________________________________________________'+iif(PlayerInfo[ID].LoginMes='ON','_','___'),GOOD);
  1695.             WriteConsole(ID,'/create <password>, /login <password>, /logout, /deletemyacc <pass>'+iif(lowercase(EnableResetStats) = lowercase('ON'),', /resetstats','             ')+iif(PlayerInfo[ID].LoginMes='ON',' |','   |'),GOOD);
  1696.             WriteConsole(ID,'/changepass <old password> <newpassword>, /changenick <password> <newnick>      '+iif(PlayerInfo[ID].LoginMes='ON',' |','   |'),GOOD);
  1697.             if (PlayerInfo[ID].Password = '') or (lowercase(EnableLastPlayed) = lowercase('ON')) or (lowercase(EnableSearch) = lowercase('ON')) or (lowercase(EnableRank) = lowercase('ON')) or (lowercase(EnableRankID) = lowercase('ON')) then WriteConsole(ID,iif(lowercase(EnableLastPlayed)=lowercase('ON'),'/lastplayed <name>','')+iif(PlayerInfo[ID].Password='',iif(lowercase(EnableLastPlayed)=lowercase('ON'),', ','')+'/addpassword <pass>'+iif(lowercase(EnableRank)=lowercase('ON'),', !rank',''),iif(lowercase(EnableRank)=lowercase('ON'),iif(lowercase(EnableLastPlayed) = lowercase('ON'),', ','')+'!rank, !rank <name>',''))+iif(lowercase(EnableRankID) = lowercase('ON'),iif((PlayerInfo[ID].Password = '') or (lowercase(EnableRank) = lowercase('ON')) or (lowercase(EnableLastPlayed) = lowercase('ON')),', ','')+'!rankid <number>','')        +       iif(lowercase(EnableSearch) = lowercase('ON'),iif((PlayerInfo[ID].Password = '') or (lowercase(EnableRank) = lowercase('ON')) or (lowercase(EnableRankID) = lowercase('ON')) or (lowercase(EnableLastPlayed) = lowercase('ON')),', ','')+'!search <name>','')       +iif(lowercase(EnableLastPlayed) = lowercase('ON'),'','                    ')+iif(PlayerInfo[ID].Password='',iif(lowercase(EnableRank) = lowercase('ON'),'','       '),'       '+iif(lowercase(EnableRank) = lowercase('ON'),'',iif(lowercase(EnableLastPlayed) = lowercase('ON'),'  ','  ')+'                   '))+   iif(lowercase(EnableRankID) = lowercase('ON'),'',iif((PlayerInfo[ID].Password = '') or (lowercase(EnableRank) = lowercase('ON')) or (lowercase(EnableLastPlayed) = lowercase('ON')),'  ','')+'                ')+   iif(lowercase(EnableSearch) = lowercase('ON'),'',iif((PlayerInfo[ID].Password = '') or (lowercase(EnableRank) = lowercase('ON')) or (lowercase(EnableRankID) = lowercase('ON')) or (lowercase(EnableLastPlayed) = lowercase('ON')),'','  ')+'                ')+iif(PlayerInfo[ID].LoginMes='ON',' |','   |'),GOOD);
  1698.             WriteConsole(ID,'____Stats Commands_______________________________________________________________'+iif(PlayerInfo[ID].LoginMes='ON','|','__|'),GOOD);
  1699.             if (lowercase(EnableStats) = lowercase('ON')) or (lowercase(MapStatsON) = lowercase('ON')) then WriteConsole(ID,iif(lowercase(EnableStats) = lowercase('ON')    ,'!stats     ','')+iif(lowercase(MapStatsON) = lowercase('ON')      ,+iif(lowercase(EnableStats) =     lowercase('ON'),'| ','')+'!mapstats   ','')+iif(lowercase(EnableStats) = lowercase('ON'),    '','             ')+iif(lowercase(MapStatsON) = lowercase('ON')  ,'','              ')+'             - View statistics: '+iif(lowercase(EnableStats) = lowercase('ON'),'players ','')+iif(lowercase(MapStatsON) = lowercase('ON'),+iif(lowercase(EnableStats) = lowercase('ON'),'| ','')+       'maps','')+iif(lowercase(EnableStats) = lowercase('ON'),'','          ')+iif(lowercase(MapStatsON) = lowercase('ON'),'','      ')+'         '+iif(PlayerInfo[ID].LoginMes='ON',' |','   |'),GOOD);
  1700.             if (lowercase(EnableTop) = lowercase('ON')) or (lowercase(TopMapsON) = lowercase('ON')) then WriteConsole(ID,iif(lowercase(EnableTop) = lowercase('ON')     ,'!top       ','')+iif(lowercase(TopMapsON) = lowercase('ON')       ,+iif(lowercase(EnableTop) =       lowercase('ON'),'| ','')+'!topmaps    ','')+iif(lowercase(EnableTop) = lowercase('ON'),      '','             ')+iif(lowercase(TopMapsON) = lowercase('ON')   ,'','              ')+'             - Top '+inttostr(TopLines)+': '+iif(lowercase(EnableTop) = lowercase('ON'),'players ','')+iif(lowercase(TopMapsON) = lowercase('ON'),+iif(lowercase(EnableTop) = lowercase('ON'),'| ','')+ 'map plays','')+iif(Length(inttostr(TopLines)) = 1,' ','  ')+iif(lowercase(EnableTop) = lowercase('ON'),'','          ')+iif(lowercase(TopMapsON) = lowercase('ON'),'','           ')+'           '+iif(PlayerInfo[ID].LoginMes='ON',' |','   |'),GOOD);
  1701.             if (lowercase(EnableFlagStats) = lowercase('ON')) or (lowercase(OtherStatsON) = lowercase('ON')) then WriteConsole(ID,iif(lowercase(EnableFlagStats) = lowercase('ON'),'!flagstats ','')+iif(lowercase(OtherStatsON) = lowercase('ON'),+iif(lowercase(EnableFlagStats) = lowercase('ON'),'| ','')+'!otherstats ','')+iif(lowercase(EnableFlagStats) = lowercase('ON'),'','             ')+iif(lowercase(OtherStatsON) = lowercase('ON'),'','              ')+'             - View '+iif(lowercase(EnableFlagStats) = lowercase('ON'),'flag ','')+iif(lowercase(OtherStatsON) = lowercase('ON'),+iif(lowercase(EnableFlagStats) = lowercase('ON'),'| ','')+          'other','')+' statistics '+iif(lowercase(EnableFlagStats) = lowercase('ON'),'','       ')+iif(lowercase(OtherStatsON) = lowercase('ON'),'','       ')+'           '+iif(PlayerInfo[ID].LoginMes='ON',' |','   |'),GOOD);
  1702.             if (lowercase(EnableServerStats) = lowercase('ON')) or (lowercase(WinStatsON) = lowercase('ON')) then WriteConsole(ID,iif(lowercase(WinStatsON) = lowercase('ON'),'!winstats  ','')+iif(lowercase(EnableServerStats) = lowercase('ON'),+iif(lowercase(WinStatsON) = lowercase('ON'),'| ','')+'!serverstats (!ss) ','')+iif(lowercase(WinStatsON) = lowercase('ON'),'','             ')+iif(lowercase(EnableServerStats) = lowercase('ON'),'','                     ')+'      - View '+iif(lowercase(WinStatsON) = lowercase('ON'),'winstats ','')+iif(lowercase(EnableServerStats) = lowercase('ON'),+iif(lowercase(WinStatsON) = lowercase('ON'),'| ','')+         'server ','')+'statistics '+iif(lowercase(WinStatsON) = lowercase('ON'),'','           ')+iif(lowercase(EnableServerStats) = lowercase('ON'),'','         ')+'      '+iif(PlayerInfo[ID].LoginMes='ON',' |','   |'),GOOD);
  1703.             if (lowercase(EnableVoteUpdate) = lowercase('ON')) then WriteConsole(ID,'!voteupdate                           - Vote per actualized statistics          '+iif(PlayerInfo[ID].LoginMes='ON',' |','   |'),GOOD);
  1704.             WriteConsole(ID,'_________________________________________________________________________________'+iif(PlayerInfo[ID].LoginMes='ON','|','__|'),GOOD);
  1705.             if (PlayerInfo[ID].LoginMes = 'OFF') then WriteConsole(ID,'Type !login for example will display info how to login! (Use to OFF this messages) |',BAD);
  1706.             if (PlayerInfo[ID].LoginMes = 'OFF') then WriteConsole(ID,'___________________________________________________________________________________|',BAD);
  1707.     end;
  1708.     if regExpMatch('^!(autor|author|credit|credits|contact|tworca|info|help|zitrofun|zitro|fun)$',lowercase(Text)) then begin
  1709.         WriteConsole(ID,'Author scripts: dominikk26',GOOD);
  1710.         WriteConsole(ID,'E-mail: dominikk262@wp.pl',GOOD);
  1711.         WriteConsole(ID,YouInfo,GOOD);
  1712.         WriteConsole(ID,'Script Version: '+ZitroVersion,GOOD);
  1713.         gracze := Explode(ReadFile('nickreg/server/players.db'),CRLF);
  1714.         WriteConsole(ID,'Registered players: '+inttostr(GetArrayLength(gracze)-2),GOOD);
  1715.     end;
  1716.     if regExpMatch('^!(login)$',lowercase(Text)) then begin
  1717.         WriteConsole(ID,'Type /login ''your password'' to login.',GOOD);
  1718.         WriteConsole(ID,'Press the first "/" and write command. Do not press "T".',GOOD);
  1719.         WriteConsole(ID,'Example: Press "/" write "login" add space and write "your password" and enter.',GOOD);
  1720.         if (PlayerInfo[ID].LoginMes = 'OFF') then begin
  1721.             PlayerInfo[ID].LoginMes := 'ON';
  1722.             UpdateNickname(ID);
  1723.         end;
  1724.     end;
  1725.     if regExpMatch('^!(addpassword)$',lowercase(Text)) then if (PlayerInfo[ID].Password = '') then WriteConsole(ID,'Type /addpassword <password> to add a password',GOOD) else WriteConsole(ID,'You already have the password function switched off',GOOD);
  1726. end;
  1727.  
  1728. procedure OnFlagScore(ID, TeamFlag: byte);
  1729. var i: byte; KD, AB: double;
  1730. begin
  1731.     if (lowercase(MapStatsON) = lowercase('ON')) then begin
  1732.         MapFlagCaps := inttostr(strtoint(MapFlagCaps) + 1);
  1733.         UpdateMapStats(currentmap);
  1734.     end;
  1735.     if (lowercase(EnableFlagStats) = lowercase('ON')) then begin
  1736.         flager[ID] := 0;
  1737.         if (PlayerInfo[ID].NickStatus = true) then begin
  1738.             PlayerStats[ID].FlagScore := inttostr(strtoint(PlayerStats[ID].FlagScore) + 1);
  1739.             UpdateNickname(ID);
  1740.             if (GetPlayerStat(ID,'Team') = 1) then begin
  1741.                 PlayerStats[ID].AlphaCaps := inttostr(strtoint(PlayerStats[ID].AlphaCaps) + 1);
  1742.                 UpdateNickname(ID);
  1743.             end;
  1744.             if (GetPlayerStat(ID,'Team') = 2) then begin
  1745.                 PlayerStats[ID].BravoCaps := inttostr(strtoint(PlayerStats[ID].BravoCaps) + 1);
  1746.                 UpdateNickname(ID);
  1747.             end;
  1748.         end;
  1749.         if (GameStyle = 5) then begin
  1750.             for i:=1 to 32 do begin
  1751.                 if (GetPlayerStat(i,'Active')=true) and (PlayerInfo[ID].NickStatus = true) then begin
  1752.                     if (GetPlayerStat(i,'Team')=1) then begin
  1753.                         if not (BravoPlayers = 0) then begin
  1754.                             AB := (single(AlphaPlayers) / single(BravoPlayers));
  1755.                             KD := (single(StrtoInt(ReadINI('soldat.ini','GAME','Red_Points_Capture','30'))) / strtoint(FormatFloat('0',AB)));
  1756.                         end else KD := (StrtoInt(ReadINI('soldat.ini','GAME','Red_Points_Capture','30')) - 5);
  1757.                         PlayerStats[ID].INF_Red := (inttostr(strtoint(PlayerStats[ID].INF_Red) + strtoint(FormatFloat('0',KD))));
  1758.                         UpdateNickname(i);
  1759.                     end;
  1760.                 end;
  1761.             end;
  1762.         end;
  1763.     end;
  1764. end;
  1765.  
  1766. procedure OnFlagDrop(ID, TeamFlag: byte);
  1767. begin
  1768.     if (lowercase(MapStatsON) = lowercase('ON')) then begin
  1769.         MapFlagDrop := inttostr(strtoint(MapFlagDrop) + 1);
  1770.         UpdateMapStats(currentmap);
  1771.     end;
  1772.     if (lowercase(EnableFlagStats) = lowercase('ON')) then if (PlayerInfo[ID].NickStatus = true) then begin
  1773.         PlayerStats[ID].FlagDrop := inttostr(strtoint(PlayerStats[ID].FlagDrop) + 1);
  1774.         UpdateNickname(ID);
  1775.     end;
  1776. end;
  1777.  
  1778. procedure AppOnIdle(Ticks: integer);
  1779. var b, i: byte;
  1780. begin
  1781.     ShootKeyCheck();
  1782.     if (NumPlayers = 0) then AppOnIdleTimer := 120 else AppOnIdleTimer := 1;
  1783.     if Ticks mod (6 * 1) = 0 then for i := 1 to 32 do if(GetPlayerStat(i,'Active')=true) then begin
  1784.         if (flager[i] = 0) then if (GetPlayerStat(i,'Flagger') = true) then flager[i] := 1;
  1785.         if (flager[i] = 1) then if (GetPlayerStat(i,'Flagger') = false) and (GetPlayerStat(i, 'alive') = false) then begin
  1786.             OnFlagDrop(i, GetPlayerStat(i, 'Team'));
  1787.             flager[i] := 0;
  1788.         end;
  1789.     end;
  1790.     if Ticks mod (3600 * 11) = 0 then if (lowercase(TimeMesON) = lowercase('ON')) then WriteConsole(0, 'Enter !reginfo to see command. Information: !contact', GOOD);
  1791.     if Ticks mod (60 * 1) = 0 then begin
  1792.         for b := 1 to 32 do if(GetPlayerStat(b,'Active')=true) then begin
  1793.             if (PlayerInfo[b].startKickTimer = 1) then begin
  1794.                 dec(PlayerInfo[b].kickTimer,1);
  1795.                 if (PlayerInfo[b].kickTimer = 0) then begin
  1796.                     WriteConsole(b,'You need to register your nickname!',BAD);
  1797.                     kickPlayer(b);
  1798.                 end;
  1799.             end;
  1800.         end;
  1801.         if (Time > 0) then Time := (Time - 1) else if (Go) then begin
  1802.             Go := false;
  1803.             for i := 1 to 32 do if (GetPlayerStat(i,'Active')=true) then begin
  1804.                 Voted[i] := false;
  1805.                 WriteConsole(i,'Voting for updating statistics, ending in unsuccessful!',BAD);
  1806.             end;
  1807.             VFor := 0;      Time := 0;  //By
  1808.         end;
  1809.         if (lowercase(EnableFlagStats) = lowercase('ON')) then begin
  1810.             if (GameStyle = 5) then if (BravoScore <> INF_BravoNewScore) then begin
  1811.                 INF_BravoNewScore := BravoScore;
  1812.                 for i:=1 to 32 do if (GetPlayerStat(i,'Active')=true) then if (GetPlayerStat(i,'Team')=2) then begin
  1813.                     PlayerStats[i].INF_Blue := inttostr(strtoint(PlayerStats[i].INF_Blue) + 1);
  1814.                     UpdateNickname(i);
  1815.                 end;
  1816.             end;
  1817.             if (GameStyle = 6) then begin
  1818.                 if (AlphaScore <> HTF_AlphaNewScore) then begin
  1819.                     HTF_AlphaNewScore := AlphaScore;
  1820.                     for i:=1 to 32 do if (GetPlayerStat(i,'Active')=true) then if (GetPlayerStat(i,'Team')=1) then begin
  1821.                         PlayerStats[i].HTF_Red := inttostr(strtoint(PlayerStats[i].HTF_Red) + 1);
  1822.                         UpdateNickname(i);
  1823.                     end;
  1824.                 end;
  1825.                 if (BravoScore <> HTF_BravoNewScore) then begin
  1826.                     HTF_BravoNewScore := BravoScore;
  1827.                     for i:=1 to 32 do if (GetPlayerStat(i,'Active')=true) then if (GetPlayerStat(i,'Team')=2) then begin
  1828.                         PlayerStats[i].HTF_Blue := inttostr(strtoint(PlayerStats[i].HTF_Blue) + 1);
  1829.                         UpdateNickname(i);
  1830.                     end;
  1831.                 end;
  1832.             end;
  1833.         end;
  1834.         if (lowercase(TimeMesON) = lowercase('ON')) then if Ticks mod (3600 * TimeMes) = 0 then for b := 1 to 32 do if (GetPlayerStat(b,'Active')=true) then if (PlayerInfo[b].Password = '') then if (PlayerInfo[b].DelAcc = 'NO') then WriteConsole(b,'To better protect account please add password /addpassword <password>',BAD);
  1835.         for b := 1 to 32 do if (GetPlayerStat(b,'Active')=true) then begin
  1836.             if (timer[b] = 1) then begin
  1837.                 dec(Ttimer[b],1);
  1838.                 if (Ttimer[b] = 0) then begin
  1839.                     atc[b] := 0;        timer[b] := 0;
  1840.                 end;
  1841.             end;
  1842.             if (CooldownTimer <> 0) then for i := 1 to 32 do if (PlayersInfoArr[b].DamageRecievedByCooldown[i] >= 1) then PlayersInfoArr[b].DamageRecievedByCooldown[i] := PlayersInfoArr[b].DamageRecievedByCooldown[i] - 1;
  1843.             if (((Getplayerstat(b,'Health')*100)/MaxHealth) > ((100-TotalPercentDamageRecieved(b)))) then RemoveDamageDoneBy(b,((Getplayerstat(b,'Health')*100)/MaxHealth) - (100-TotalPercentDamageRecieved(b)));
  1844.             if (lowercase(TimeMesON) = lowercase('ON')) then if (lowercase(AntyMajor) = lowercase('ON')) then if (lowercase(GetPlayerStat(b,'name')) = lowercase('Major')) then exit else if ((FileExists('nickreg/'+FilterFilename(GetPlayerStat(b,'name'))+'.txt') = false) or (PlayerInfo[b].DelAcc = 'YES')) then DrawTextEx(b,72,'Type /create <password> to create account',160,$FF0000,0.07,106,420) else if (PlayerInfo[b].NickStatus = false) then DrawTextEx(b,72,'Type /login <password> to login.',160,$FF0000,0.07,184,420) else if (PlayerInfo[b].Password = '') then DrawTextEx(b,72,'           Plese add password'+CRLF+'Type /addpassword <password>',160,$FF0000,0.07,188,405);
  1845.         end;
  1846.     end;
  1847. end;
  1848.  
  1849. procedure OnPlayerSpeak(ID: byte; Text: string);
  1850. var i: byte; n, c: integer; b: word; gracze: TStringArray; buffer: array[1..10] of string; buffer2: string;
  1851. begin
  1852.     if regExpMatch('^!(otherstats)$',lowercase(Text)) then Inne(ID) else if MaskCheck(Text,'!otherstats *') then InneOther(ID,Copy(Text,13,Length(Text)));
  1853.     if regExpMatch('^!(winstats)$',lowercase(Text)) then WinStats(ID) else if MaskCheck(Text,'!winstats *') then WinStatsOther(ID,Copy(Text,11,Length(Text)));
  1854.     if regExpMatch('^!(top)$',lowercase(Text)) then PokazTop(ID) else if MaskCheck(lowercase(Text),'!top *') then PokazTopID(ID,strtoint(Copy(Text,6,Length(Text))));
  1855.     if regExpMatch('^!(rank)$',lowercase(Text)) then RankTXT(ID,Copy(Text,7,Length(Text))) else if MaskCheck(lowercase(Text),'!rank *') then RankTXT(ID,Copy(Text,7,Length(Text)));
  1856.     if MaskCheck(lowercase(Text),'!rankid *') then RankID(ID,strtoint(Copy(Text,9,Length(Text))));
  1857.     if regExpMatch('^!(maptop|topmap|topmaps|mapstop)$',lowercase(Text)) then PokazTopMaps(ID);
  1858.     if regExpMatch('^!(reginfo|autor|author|credit|credits|contact|tworca|info|help|zitrofun|zitro|fun|create|login|logout|changepass|changenick|addpassword|lastplayed|resetstats)$',lowercase(Text)) then Informacje(ID, Text);
  1859.     if regExpMatch('^!(stats|raning|statystyki)$',lowercase(Text)) then Stats(ID) else if MaskCheck(Text,'!stats *') then StatsOther(ID,Copy(Text,8,Length(Text)));
  1860.     if regExpMatch('^!(flag|flagstats|flaga|statsflag|statsflaga)$',lowercase(Text)) then FlagStats(ID) else if MaskCheck(Text,'!flagstats *') then FlagStatsOther(ID,Copy(Text,12,Length(Text)));
  1861.     if regExpMatch('^!(serverstats|serwerstats|ss|servstats|serwstats|serstats|statsser|statsserv|statsserw)$',lowercase(Text)) then ServerStats(ID);
  1862.     if regExpMatch('^!(voteupdate|update|updatevote|aktualizuj|aktualizacja|updaterank|updateranks)$',lowercase(Text)) then VoteUpdate(ID);
  1863.     if regExpMatch('^!(mapstats|statsmap|mapastats|mapastatystyki)$',lowercase(Text)) then DisplayMapStats(ID) else if MaskCheck(Text,'!mapstats *') then DisplayMapStatsMAP(ID,Copy(Text,11,Length(Text)));
  1864.     if MaskCheck(lowercase(Text),'!search *') then begin
  1865.         if (lowercase(EnableSearch) = lowercase('ON')) then begin delete(Text,1,8);
  1866.             if (Text<>'') then begin
  1867.                 gracze := Explode(ReadFile('nickreg/server/players.db'),CRLF);
  1868.                 c := 1;     n := 0;
  1869.                 for b:= 2 to (GetArrayLength(gracze)-1) do begin
  1870.                     if (ContainsString(lowercase(gracze[b-1]),lowercase(Text))=true) then begin
  1871.                         if (length(buffer[c])<72) then buffer[c] := buffer[c]+iif((buffer[c]<>''),', ','')+gracze[b-1] else begin
  1872.                             inc(c,1);
  1873.                             buffer[c] := buffer[c]+iif((buffer[c]<>''),', ','')+gracze[b-1];
  1874.                         end;
  1875.                         n := n+1;
  1876.                         if (n=50) then break;
  1877.                     end;
  1878.                 end;
  1879.                 WriteConsole(ID,'Search for '+Text+':',GOOD);
  1880.                 for i := 1 to 10 do begin
  1881.                     if (buffer[i] <> '') then WriteConsole(ID,buffer[i],GOOD);
  1882.                     buffer2 := buffer2+buffer[i];
  1883.                 end;
  1884.                 if (buffer2 = '') then  WriteConsole(ID,'Nothing was found!',BAD);
  1885.             end else WriteConsole(ID,'You must enter the text.',BAD);
  1886.         end else WriteConsole(ID,'Function search has been disabled by an administrator.',BAD);
  1887.     end;
  1888. end;
  1889.  
  1890. function OnPlayerDamageEx(Victim, Shooter: Byte; Damage: Integer; Weapon: Byte): Integer;
  1891. var TmpDble: double;
  1892. begin
  1893.     if (Victim <> Shooter) then begin
  1894.         if (lowercase(OtherStatsON) = lowercase('ON')) then if (PlayerInfo[Shooter].NickStatus = true) then begin
  1895.             if (GameStyle = 0) or (GameStyle = 1) or (GameStyle = 4) then begin
  1896.                 if ((Weapon = 16) and (Damage >= 25)) or ((Weapon = 7) and (Damage >= 40)) then PlayerStats[Shooter].ShootHit := inttostr(strtoint(PlayerStats[Shooter].ShootHit) + 1);
  1897.                 if (Weapon <> 16) and (Weapon <> 7) and (Weapon <> 50) and (Weapon <> 15) then PlayerStats[Shooter].ShootHit := inttostr(strtoint(PlayerStats[Shooter].ShootHit) + 1);
  1898.             end else
  1899.             begin
  1900.                 if (GetPlayerStat(Shooter,'Team')<>GetPlayerStat(Victim,'Team')) then begin
  1901.                     if ((Weapon = 16) and (Damage >= 25)) or ((Weapon = 7) and (Damage >= 40)) then PlayerStats[Shooter].ShootHit := inttostr(strtoint(PlayerStats[Shooter].ShootHit) + 1);
  1902.                     if (Weapon <> 16) and (Weapon <> 7) and (Weapon <> 50) and (Weapon <> 15) then PlayerStats[Shooter].ShootHit := inttostr(strtoint(PlayerStats[Shooter].ShootHit) + 1);
  1903.                 end;
  1904.                 if (GetPlayerStat(Victim,'Team')=GetPlayerStat(Shooter,'Team')) then PlayerStats[Shooter].ShootFriendly := inttostr(strtoint(PlayerStats[Shooter].ShootFriendly) + 1);
  1905.             end;
  1906.             if (lowercase(RealTimeUpdate) = lowercase('ON')) then UpdateNickname(Shooter);
  1907.         end;
  1908.         if (GameStyle = 0) or (GameStyle = 1) or (GameStyle = 4) then begin
  1909.             if (GetPlayerStat(Shooter,'active') = true) then begin
  1910.                 atc[Shooter] := Victim;
  1911.                 Ttimer[Shooter] := TimeCon;
  1912.                 timer[Shooter] := 1;
  1913.             end;
  1914.         end else
  1915.         begin
  1916.             if not (GetPlayerStat(Shooter, 'Team') = GetPlayerStat(Victim, 'Team')) then begin
  1917.                 if (GetPlayerStat(Shooter,'active') = true) then begin
  1918.                     atc[Shooter] := Victim;
  1919.                     Ttimer[Shooter] := TimeCon;
  1920.                     timer[Shooter] := 1;
  1921.                 end;
  1922.             end;
  1923.         end;
  1924.     end;
  1925.     if (Damage > 0) then begin
  1926.         if (GetplayerStat(victim,'Alive') = true) then begin
  1927.             if ((GetplayerStat(Victim,'Health') - damage) <= 0) then begin
  1928.                 if (GetplayerStat(Victim,'Health') > 0) then begin
  1929.                     TmpDble := ((GetplayerStat(Victim,'Health')*100)/MaxHealth);
  1930.                     PlayersInfoArr[Victim].DamageRecievedByID[Shooter] := (PlayersInfoArr[Victim].DamageRecievedByID[Shooter] + TmpDble);
  1931.                     PlayersInfoArr[Victim].DamageRecievedByCooldown[Shooter] := CooldownTimer;
  1932.                 end else begin
  1933.                     if (TotalPercentDamageRecieved(victim) < 100) then begin
  1934.                         TmpDble := 100 - TotalPercentDamageRecieved(victim);
  1935.                         PlayersInfoArr[Victim].DamageRecievedByID[Shooter] := (PlayersInfoArr[Victim].DamageRecievedByID[Shooter] + TmpDble);
  1936.                         PlayersInfoArr[Victim].DamageRecievedByCooldown[Shooter] := CooldownTimer;
  1937.                     end;
  1938.                 end;
  1939.             end else begin
  1940.                 TmpDble := ((Damage*100)/MaxHealth);
  1941.                 PlayersInfoArr[Victim].DamageRecievedByID[Shooter] := (PlayersInfoArr[Victim].DamageRecievedByID[Shooter] + TmpDble);
  1942.                 PlayersInfoArr[Victim].DamageRecievedByCooldown[Shooter] := CooldownTimer;
  1943.             end;
  1944.         end else begin
  1945.             if (MostPercentDamagedoneBy(Victim) > 0) then begin
  1946.                 if (TotalPercentDamageRecieved(victim) = 0) then begin
  1947.                     PlayersInfoArr[Victim].DamageRecievedByID[Shooter] := 100;
  1948.                     PlayersInfoArr[Victim].DamageRecievedByCooldown[Shooter] := CooldownTimer;
  1949.                 end else if (TotalPercentDamageRecieved(victim) < 100) then begin
  1950.                     TmpDble := 100 - TotalPercentDamageRecieved(victim);
  1951.                     PlayersInfoArr[Victim].DamageRecievedByID[Shooter] := (PlayersInfoArr[Victim].DamageRecievedByID[Shooter] + TmpDble);
  1952.                     PlayersInfoArr[Victim].DamageRecievedByCooldown[Shooter] := CooldownTimer;
  1953.                 end;
  1954.             end else if (TotalPercentDamageRecieved(victim) < 100) then begin
  1955.                 TmpDble := (100 - TotalPercentDamageRecieved(victim));
  1956.                 PlayersInfoArr[Victim].DamageRecievedByID[Shooter] := (PlayersInfoArr[Victim].DamageRecievedByID[Shooter] + TmpDble);
  1957.                 PlayersInfoArr[Victim].DamageRecievedByCooldown[Shooter] := CooldownTimer;
  1958.             end;
  1959.         end;
  1960.     end else if (Damage < 0) then RemoveDamageDoneBy(victim,(Damage*100)/MaxHealth);
  1961.     Result:=damage;
  1962. end;
  1963.  
  1964. Procedure OnJoinTeam(ID, Team: byte);
  1965. var i: byte;
  1966. begin
  1967.     if (GetPlayerStat(ID,'Human') = true) then begin
  1968.         if (lowercase(AntyMulti) = lowercase('ON')) then for i := 1 to 32 do if (GetPlayerStat(i,'Active') = true) then if (GetPlayerStat(i,'HWID') = GetPlayerStat(ID,'HWID')) and (i<>ID) then begin
  1969.             WriteConsole(ID,'Please stop buggs! You can not, go two accounts per server at a time.',BAD);
  1970.             WriteConsole(0,'[ZitroFUN] I detected two players with the same HWID, '+GetPlayerStat(i,'Name')+' and '+GetPlayerStat(ID,'Name'),BAD);
  1971.             KickPlayer(ID);
  1972.         end;
  1973.         if (lowercase(EnableServerStats) = lowercase('ON')) then begin
  1974.             case (Team) of
  1975.                 1: AlphaV := inttostr(strtoint(Visit) + 1);
  1976.                 2: BlueV := inttostr(strtoint(BlueV) + 1);
  1977.                 3: CharlieV := inttostr(strtoint(CharlieV) + 1);
  1978.                 4: DeltaV := inttostr(strtoint(DeltaV) + 1);
  1979.                 5: SpecV := inttostr(strtoint(SpecV) + 1);
  1980.             end;
  1981.         end;
  1982.         UpdateServStats();
  1983.     end;
  1984. end;
  1985.  
  1986. Procedure AutoRegLog(ID: byte);
  1987. begin
  1988.     if (lowercase(AntyMajor) = lowercase('ON')) then if (lowercase(GetPlayerStat(ID,'name')) <> lowercase('Major')) then LoadNickname(ID) else begin
  1989.         WriteConsole(ID,'Change the nickname to use statistics.',BAD);
  1990.         Exit;
  1991.     end;
  1992.     if (FileExists('nickreg/'+filterFileName(GetPlayerStat(ID,'name'))+'.txt') = false) or (PlayerInfo[ID].DelAcc = 'YES') then begin
  1993.         if (lowercase(AutoRegister) = lowercase('ON')) then begin
  1994.             AutoSaveNickname(DefaultAutoLogin, ID);
  1995.             LoadNickname(ID);
  1996.             WriteConsole(ID,'Nickname ' + GetPlayerStat(ID,'name') + ' successfully auto registered!',GOOD);
  1997.             WriteConsole(ID,'To better protect account add password /addpassword <password>',GOOD);
  1998.             WriteConsole(ID,'We will automatically you to login via HWID you can change the IP or add a password and disable autologin.',GOOD);
  1999.             WriteLn('NickReg: ' + GetPlayerStat(ID,'name') + ' registered from ' + GetPlayerStat(ID,'HWID'));
  2000.             PlayerInfo[ID].NickStatus := true;
  2001.         end else
  2002.         begin
  2003.             WriteConsole(ID,'The nickname '+GetPlayerStat(ID,'name')+' is not registered!',GOOD);
  2004.             WriteConsole(ID,'To protect your nickname type: /create <yourpasswordhere>',GOOD);
  2005.         end;
  2006.     end else if (PlayerInfo[ID].DelAcc = 'NO') then AutoLogin(ID) else
  2007.     begin
  2008.         WriteConsole(ID,'The nickname '+GetPlayerStat(ID,'name')+' is not registered!',GOOD);
  2009.         WriteConsole(ID,'To protect your nickname type: /create <yourpasswordhere>',GOOD);
  2010.     end;
  2011. end;
  2012.  
  2013. procedure OnJoinGame(ID, Team: byte);
  2014. var i: byte;
  2015. begin
  2016.     if (lowercase(MapStatsON) = lowercase('ON')) then begin
  2017.         MapPlayerJoins := inttostr(strtoint(MapPlayerJoins) + 1);
  2018.         UpdateMapStats(currentmap);
  2019.     end;
  2020.     if (lowercase(EnableServerStats) = lowercase('ON')) then begin
  2021.         Visit := inttostr(strtoint(Visit) + 1);
  2022.         UpdateServStats();
  2023.     end;
  2024.     AutoRegLog(ID);
  2025.     PlayersInfoArr[ID].KilledBy := 0;
  2026.     for i := 1 to 33 do begin
  2027.         PlayersInfoArr[ID].DamageRecievedByID[i] := 0;
  2028.         PlayersInfoArr[ID].DamageRecievedByCooldown[i] := 0;
  2029.     end;
  2030. end;
  2031.  
  2032. procedure OnFlagGrab(ID, TeamFlag: byte;GrabbedInBase: boolean);
  2033. begin
  2034.     if (lowercase(MapStatsON) = lowercase('ON')) then begin
  2035.         MapFlagGrabs := inttostr(strtoint(MapFlagGrabs) + 1);
  2036.         UpdateMapStats(currentmap);
  2037.     end;
  2038.     if (lowercase(EnableFlagStats) = lowercase('ON')) then if (PlayerInfo[ID].NickStatus = true) then begin
  2039.         PlayerStats[ID].FlagGrab := inttostr(strtoint(PlayerStats[ID].FlagGrab) + 1);
  2040.         UpdateNickname(ID);
  2041.     end;
  2042. end;
  2043.  
  2044. procedure OnFlagReturn(ID, TeamFlag: byte);
  2045. begin
  2046.     if (lowercase(MapStatsON) = lowercase('ON')) then begin
  2047.         MapFlagReturns := inttostr(strtoint(MapFlagReturns) + 1);
  2048.         UpdateMapStats(currentmap);
  2049.     end;
  2050.     if (lowercase(EnableFlagStats) = lowercase('ON')) then if (PlayerInfo[ID].NickStatus = true) then begin
  2051.         PlayerStats[ID].FlagReturn := inttostr(strtoint(PlayerStats[ID].FlagReturn) + 1);
  2052.         UpdateNickname(ID);
  2053.     end;
  2054. end;
  2055.  
  2056. procedure OnPlayerRespawn(ID: byte);
  2057. var i: byte;
  2058. begin
  2059.     for i:=1 to 33 do begin
  2060.         PlayersInfoArr[ID].DamageRecievedByID[i] := 0;
  2061.         PlayersInfoArr[ID].DamageRecievedByCooldown[i] := 0;
  2062.     end;
  2063.     PlayersInfoArr[ID].KilledBy := 0;
  2064. end;
  2065.  
  2066. procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
  2067. var i: byte;
  2068. begin
  2069.     if (lowercase(MapStatsON) = lowercase('ON')) then begin
  2070.         if (kicked) then MapPlayerKicks := inttostr(strtoint(MapPlayerKicks) + 1) else MapPlayerLeaves := inttostr(strtoint(MapPlayerLeaves) + 1);
  2071.         UpdateMapStats(currentmap);
  2072.     end;
  2073.     if (lowercase(EnableServerStats) = lowercase('ON')) then begin
  2074.         if (kicked) then SKick := inttostr(strtoint(SKick) + 1);
  2075.         UpdateServStats();
  2076.     end;
  2077.     if (lowercase(EnableTop) = lowercase('ON')) then if (PlayerInfo[ID].NickStatus = true) then begin
  2078.         if (GetPlayerStat(ID, 'Human') = true) then UpdateRanks(ID);
  2079.         SaveRanks();
  2080.     end;
  2081.     if (Voted[ID]) then begin
  2082.         Voted[ID] := false;     VFor := (VFor - 1);
  2083.     end else
  2084.     begin
  2085.         if (NumPlayers > 1) then if (VFor / (NumPlayers - 1) * 100 >= Procent) then begin
  2086.             Go := false;
  2087.             for i := 1 to 32 do Voted[i] := false;
  2088.             VFor := 0;      Time := 0;
  2089.             for i := 1 to 32 do if (GetPlayerStat(i, 'Active') = true) then begin
  2090.                 WriteConsole(i,'Votes for updated statistics finished successfully.',GOOD);
  2091.                 WriteConsole(i,'Updated stats!',GOOD);
  2092.                 UpdateNickname(i);
  2093.                 if (lowercase(EnableTop) = lowercase('ON')) then if (GetPlayerStat(i, 'Human') = true) then UpdateRanks(i);
  2094.                 SaveRanks();
  2095.             end;
  2096.         end;
  2097.     end;
  2098.     if (PlayerInfo[ID].NickStatus = true) then begin
  2099.         UpdateNickname(ID);
  2100.         ResetVar(ID);
  2101.     end;
  2102.     for i := 1 to 32 do begin
  2103.         if (Getplayerstat(i,'Active')) then begin
  2104.             if (PlayersInfoArr[i].DamageRecievedByID[ID] <> 0) then begin
  2105.                 PlayersInfoArr[i].DamageRecievedByID[33] := (PlayersInfoArr[i].DamageRecievedByID[33] + PlayersInfoArr[i].DamageRecievedByID[ID]);
  2106.                 PlayersInfoArr[i].DamageRecievedByID[ID] := 0;
  2107.             end;
  2108.         end;
  2109.     end;
  2110.     for i := 1 to 33 do PlayersInfoArr[ID].DamageRecievedByID[i] := 0;
  2111.     PlayersInfoArr[ID].KilledBy := 0;
  2112. end;
  2113.  
  2114. procedure OnGameEnd();
  2115. var i, c: byte; l, l2: boolean;
  2116. begin
  2117.     if (GameStyle = 0) or (GameStyle = 1) or (GameStyle = 4) then begin
  2118.         l:=false;   l2:=false;
  2119.         if (MinimalKills = 0) then MinimalKills := Round(StrtoInt(ReadINI('soldat.ini','GAME',iif(GameStyle = 0,'Deathmatch_Limit',iif(GameStyle=1,'Pointmatch_Limit','Rambomatch_Limit')),'35'))/2);
  2120.         for i := 1 to 32 do if (GetPlayerStat(i,'Active')=true) then if (GetPlayerStat(i,'Kills')>=MinimalKills) then begin
  2121.             l:= true; break;
  2122.         end;
  2123.         if (l=true) then begin
  2124.             for i := 1 to 32 do if (GetPlayerStat(i,'Active')=true) then begin
  2125.                 if (GetPlayerStat(c,'Kills')=GetPlayerStat(i,'Kills')) then begin
  2126.                     if (GetPlayerStat(c,'Deaths')>GetPlayerStat(i,'Deaths')) then c:=i;
  2127.                 end else if (GetPlayerStat(c,'Kills')<GetPlayerStat(i,'Kills')) then c:=i;
  2128.             end;
  2129.             for i := 1 to 32 do if (GetPlayerStat(i,'Active')=true) then begin
  2130.                 if (i<>c) then begin
  2131.                     if ((GetPlayerStat(c,'Kills')=GetPlayerStat(i,'Kills')) and (GetPlayerStat(c,'Deaths')=GetPlayerStat(i,'Deaths'))) then begin
  2132.                         l2:=true;
  2133.                         PlayerStats[i].Remis := inttostr(strtoint(PlayerStats[i].Remis) + 1);
  2134.                     end else PlayerStats[i].lose := inttostr(strtoint(PlayerStats[i].lose) + 1);
  2135.                     UpdateNickname(i);
  2136.                 end;
  2137.             end;
  2138.             if (l2=true) then PlayerStats[c].Remis := inttostr(strtoint(PlayerStats[c].Remis) + 1) else PlayerStats[c].Win := inttostr(strtoint(PlayerStats[c].Win) + 1);
  2139.             UpdateNickname(c);
  2140.         end;    exit;
  2141.     end;
  2142.     case (GameStyle) of
  2143.         3,5,6:  begin
  2144.                     for i := 1 to 32 do if (GetPlayerStat(i,'Active')) then begin
  2145.                         if (GetPlayerStat(i,'Team') = 1) then begin
  2146.                             if (StrtoInt(ReadINI('soldat.ini','GAME',iif(GameStyle = 3,'Capture_Limit',iif(GameStyle=5,'Infiltration_Limit','Hold_Limit')),'10')) = AlphaScore) or ((BravoScore < AlphaScore) and (CharlieScore < AlphaScore) and (DeltaScore < AlphaScore)) then begin
  2147.                                 PlayerStats[i].AlphaWins := inttostr(strtoint(PlayerStats[i].AlphaWins) + 1);
  2148.                                 PlayerStats[i].Win := inttostr(strtoint(PlayerStats[i].Win) + 1);
  2149.                             end else
  2150.                             begin
  2151.                                 if (AlphaScore < BravoScore) or (AlphaScore < DeltaScore) or (AlphaScore < CharlieScore) then begin
  2152.                                     PlayerStats[i].AlphaLose := inttostr(strtoint(PlayerStats[i].AlphaLose) + 1);
  2153.                                     PlayerStats[i].lose := inttostr(strtoint(PlayerStats[i].lose) + 1);
  2154.                                 end else PlayerStats[i].Remis := inttostr(strtoint(PlayerStats[i].Remis) + 1);
  2155.                             end;
  2156.                         end;
  2157.                         if (GetPlayerStat(i,'Team') = 2) then begin
  2158.                             if (StrtoInt(ReadINI('soldat.ini','GAME','Teammatch_Limit','60')) = BravoScore) or ((AlphaScore < BravoScore) and (CharlieScore < BravoScore) and (DeltaScore < BravoScore)) then begin
  2159.                                 PlayerStats[i].BravoWins := inttostr(strtoint(PlayerStats[i].BravoWins) + 1);
  2160.                                 PlayerStats[i].Win := inttostr(strtoint(PlayerStats[i].Win) + 1);
  2161.                             end else
  2162.                             begin
  2163.                                 if (BravoScore < AlphaScore) or (BravoScore < DeltaScore) or (BravoScore < CharlieScore) then begin
  2164.                                     PlayerStats[i].BravoLose := inttostr(strtoint(PlayerStats[i].BravoLose) + 1);
  2165.                                     PlayerStats[i].lose := inttostr(strtoint(PlayerStats[i].lose) + 1)
  2166.                                 end else PlayerStats[i].Remis := inttostr(strtoint(PlayerStats[i].Remis) + 1);
  2167.                             end;
  2168.                         end;
  2169.                         UpdateNickname(i);
  2170.                     end;
  2171.                 end;
  2172.         2:  begin
  2173.                 for i := 1 to 32 do if (GetPlayerStat(i,'Active')) then begin
  2174.                     case (GetPlayerStat(i,'Team')) of
  2175.                         1:  begin
  2176.                                 if (StrtoInt(ReadINI('soldat.ini','GAME','Teammatch_Limit','60')) = AlphaScore) or ((BravoScore < AlphaScore) and (CharlieScore < AlphaScore) and (DeltaScore < AlphaScore)) then begin
  2177.                                     PlayerStats[i].AlphaWins := inttostr(strtoint(PlayerStats[i].AlphaWins) + 1);
  2178.                                     PlayerStats[i].Win := inttostr(strtoint(PlayerStats[i].Win) + 1);
  2179.                                 end else
  2180.                                 begin
  2181.                                     if (AlphaScore < BravoScore) or (AlphaScore < DeltaScore) or (AlphaScore < CharlieScore) then begin
  2182.                                         PlayerStats[i].AlphaLose := inttostr(strtoint(PlayerStats[i].AlphaLose) + 1);
  2183.                                         PlayerStats[i].lose := inttostr(strtoint(PlayerStats[i].lose) + 1);
  2184.                                     end else PlayerStats[i].Remis := inttostr(strtoint(PlayerStats[i].Remis) + 1);
  2185.                                 end;
  2186.                             end;
  2187.                         2:  begin
  2188.                                 if (StrtoInt(ReadINI('soldat.ini','GAME','Teammatch_Limit','60')) = BravoScore) or ((AlphaScore < BravoScore) and (CharlieScore < BravoScore) and (DeltaScore < BravoScore)) then begin
  2189.                                     PlayerStats[i].BravoWins := inttostr(strtoint(PlayerStats[i].BravoWins) + 1);
  2190.                                     PlayerStats[i].Win := inttostr(strtoint(PlayerStats[i].Win) + 1);
  2191.                                 end else
  2192.                                 begin
  2193.                                     if (BravoScore < AlphaScore) or (BravoScore < DeltaScore) or (BravoScore < CharlieScore) then begin
  2194.                                         PlayerStats[i].BravoLose := inttostr(strtoint(PlayerStats[i].BravoLose) + 1);
  2195.                                         PlayerStats[i].lose := inttostr(strtoint(PlayerStats[i].lose) + 1)
  2196.                                     end else PlayerStats[i].Remis := inttostr(strtoint(PlayerStats[i].Remis) + 1);
  2197.                                 end;
  2198.                             end;
  2199.                         3:  begin
  2200.                                 if (StrtoInt(ReadINI('soldat.ini','GAME','Teammatch_Limit','60')) = CharlieScore) or ((AlphaScore < CharlieScore) and (BravoScore < CharlieScore) and (DeltaScore < CharlieScore)) then begin
  2201.                                     PlayerStats[i].CharlieWin := inttostr(strtoint(PlayerStats[i].CharlieWin) + 1);
  2202.                                     PlayerStats[i].Win := inttostr(strtoint(PlayerStats[i].Win) + 1);
  2203.                                 end else
  2204.                                 begin
  2205.                                     if (CharlieScore < AlphaScore) or (CharlieScore < BravoScore) or (CharlieScore < DeltaScore) then begin
  2206.                                         PlayerStats[i].CharlieLose := inttostr(strtoint(PlayerStats[i].CharlieLose) + 1);
  2207.                                         PlayerStats[i].lose := inttostr(strtoint(PlayerStats[i].lose) + 1)
  2208.                                     end else PlayerStats[i].Remis := inttostr(strtoint(PlayerStats[i].Remis) + 1);
  2209.                                 end;
  2210.                             end;
  2211.                         4:  begin
  2212.                                 if (StrtoInt(ReadINI('soldat.ini','GAME','Teammatch_Limit','60')) = DeltaScore) or ((AlphaScore < DeltaScore) and (BravoScore < DeltaScore) and (CharlieScore < DeltaScore)) then begin
  2213.                                     PlayerStats[i].DeltaWin := inttostr(strtoint(PlayerStats[i].DeltaWin) + 1);
  2214.                                     PlayerStats[i].Win := inttostr(strtoint(PlayerStats[i].Win) + 1);
  2215.                                 end else
  2216.                                 begin
  2217.                                     if (DeltaScore < AlphaScore) or (DeltaScore < BravoScore) or (DeltaScore < CharlieScore) then begin
  2218.                                         PlayerStats[i].DeltaLose := inttostr(strtoint(PlayerStats[i].DeltaLose) + 1);
  2219.                                         PlayerStats[i].lose := inttostr(strtoint(PlayerStats[i].lose) + 1)
  2220.                                     end else PlayerStats[i].Remis := inttostr(strtoint(PlayerStats[i].Remis) + 1);
  2221.                                 end;
  2222.                             end;
  2223.                     end;
  2224.                     UpdateNickname(i);
  2225.                 end;
  2226.             end;
  2227.     end;
  2228. end;
  2229.  
  2230. procedure ActivateServer();
  2231. var b: byte;
  2232. begin
  2233.     AppOnIdleTimer := 1;
  2234.     MaxHealth := iif(Command('/realistic')='1',65,150);
  2235.     if (ReadINI('soldat.ini','GAME','Friendly_Fire','0') = '1') then FriendlyFire:=true else FriendlyFire:=false;
  2236.     if (ReadINI('soldat.ini','GAME','Survival_Mode','0') = '1') then Survival:=true else Survival:=false;
  2237.     if (FileExists('nickreg/server/players.db') = false) then WriteLnFile('nickreg/server/players.db','[PlayersList]'); if (FileExists('nickreg/maps/maps.db') = false) then WriteLnFile('nickreg/maps/maps.db','[MapList]');
  2238.     if LoadSettings('scripts/'+ ScriptName + '/settings.ini') then WriteLn(' [*] '+ ScriptName + ' -> Error while loading settings') else WriteLn(' [*] '+ ScriptName + ' -> Settings loaded successfully');
  2239.     WriteConsole(0, 'ZitroFun '+ZitroVersion+' recompiled - successfully :)', $FFFFAA00);
  2240.     if (lowercase(EnableTop) = lowercase('ON')) then LoadRanks();
  2241.     for b := 1 to 32 do begin
  2242.         ResetVar(b);
  2243.         if (GetPlayerStat(b,'Active')=true) then begin
  2244.             LoadNickname(b);
  2245.             if (PlayerInfo[b].DelAcc = 'NO') then AutoLogin(b) else
  2246.             begin
  2247.                 WriteConsole(b,'The nickname '+GetPlayerStat(b,'name')+' is not registered!',GOOD);
  2248.                 WriteConsole(b,'To protect your nickname type: /create <yourpasswordhere>',GOOD);
  2249.             end;
  2250.         end;
  2251.     end;
  2252.     CreateServerStats();
  2253.     if (lowercase(EnableServerStats) = lowercase('ON')) then ServerLoad();
  2254.     if (lowercase(MapStatsON) = lowercase('ON')) then MapStatsLoad(currentmap);
  2255.     if (lowercase(TopMapsON) = lowercase('ON')) then LoadTopMap();
  2256.     INF_BravoNewScore := 0;     HTF_BravoNewScore := 0;     HTF_AlphaNewScore := 0;
  2257. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement