Bendarr

Bendarr

Aug 14th, 2009
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 37.80 KB | None | 0 0
  1. const
  2.   FlagballMap = 'htf_FB_Classic3';
  3.   ReturnOnScore = false; // moves the flag onto it's spawn point when a team scores
  4.   AutoStart = false;
  5.   AutoEnd = false;
  6.   AdminCommands = true; // admin / commands
  7.   PublicCommandsSlash = false; // public / commands
  8.   PublicCommandsExcla = false; // ! commands
  9.   BotName = 'Boogie Man';
  10.   AppOnIdleInterval = 10; // 6 times per second (60 ticks/sec) / (10)
  11.   FoulColor = $FF00FF00;
  12.   AccidentalScoring = false;
  13.   ReturnMessage = false; // after score; "Head back to the 40 yard mark, <team name>"
  14.   FlagReadyMessage = false; // once players are allowed past the 40 yard mark (flag exits goalie area)
  15.  
  16.   WelcomeColor = $FFFBDA22;
  17.   SayColor = $FF9C9F9F;
  18.  
  19.   SuccessColor = $FF0FA0C6;
  20.   YieldColor = $FF7FBFBF;
  21.   ErrorColor = $FFBF7F7F;
  22.  
  23.   PublicPassword = true;
  24.   UnpauseCounterInitial = 3;
  25.   SayName = true;
  26.   BigConsole = true;
  27.  
  28. type
  29.   TPlayer = record
  30.     JoinGame: boolean;
  31.   end;
  32.  
  33.  
  34.   var
  35.   ActivateVariables, Passworded, KillAfter, CheckKillAfter, Ignore, StopNext, EndGame, SayMap, AlphaAlive, BravoAlive, MapsOnOff, Scored, StartOnIdle: boolean;
  36.   Gamemode, UnpauseCounter, LastTouch, PlayerNumber, AlphaNumber, BravoNumber, teami, LastKill, LastDeath: byte;
  37.   DisablePlayerScore: array[1..32] of boolean;
  38.   Players: array[1..32] of TPlayer;
  39.   TextWidth : array[32..127] of single;
  40.   Captures: array[1..32] of byte;
  41.   Kills, Deaths: array[1..32] of word;
  42.   pmvar: integer;
  43.  
  44.  
  45.  
  46. procedure Greet(const Id: byte);
  47. begin
  48.   WriteConsole(Id, 'Welcome to ' + ServerName + '!', WelcomeColor);
  49.   WriteConsole(Id, 'forums.soldatrs.com - Home of Realistic / Survival', WelcomeColor);
  50.   WriteConsole(Id, '              - Current Admin List -', WelcomeColor);
  51.   WriteConsole(Id, ' Bendarr, Merox, DorkeyDear, Chikka, DutchFlame, Scream', WelcomeColor);
  52.   WriteConsole(Id, ' Ant, JRedcorn, T-Boner, Lourenzo, CharlieCypher, Richmeister24', WelcomeColor);
  53. end;
  54.  
  55.  
  56.   // by J-Factor, modified by Curt (DorkeyDear)
  57. procedure DrawTextCenter(const Id: byte; Text: string; const Delay: integer; const Color: longint; const Scale: single; const XCoord, YCoord: integer);
  58. var
  59.   i, c : byte;
  60.   TotalWidth, Width, Height : single;
  61. begin
  62.   TotalWidth := 0;
  63.   Width := 0;
  64.   Height := 202;
  65.   for i := 1 to length(Text) do begin
  66.     c := ord(Text[i]);
  67.     if ((c > 31) and (c < 128)) then begin
  68.       Width := Width + TextWidth[c];
  69.       if (Width > TotalWidth) then
  70.         TotalWidth := Width;
  71.     end else if (c = 13) then begin
  72.       Height := Height + 202;
  73.       Width := 0;
  74.     end;
  75.   end;
  76.   DrawText(ID, Copy(Text, 1, 58) + iif(Length(Text) <= 3, '  ', ''), Delay, Color, Scale, XCoord - Round(TotalWidth * Scale / 2), YCoord - Round(Height * Scale / 2));
  77. end;
  78.  
  79.  
  80. procedure Big(const Id: byte; const Text: string; const Color: longint);
  81. var
  82.   Size: single;
  83. begin
  84.   Size := 3.5 / Length(Text);
  85.   if (Size > 0.33) then
  86.     Size := 0.33;
  87.   DrawTextCenter(Id, Text, 9 * Length(Text) + 85, Color, Size, 320, 360);
  88. end;
  89.  
  90.  
  91. function StrrPos(const Substr, S: string): integer;
  92. begin
  93.   for Result := Length(S) - Length(Substr) + 1 downto 1 do
  94.     if (Copy(S, Result, Length(Substr)) = Substr) then
  95.       exit;
  96.   Result := 0;
  97. end;
  98.  
  99.  
  100. procedure Say(const Id: byte; const Text: string; const Color: longint);
  101. var
  102.   Pos: integer;
  103. begin
  104.   if (Length(Text) <= 72) then
  105.     WriteConsole(Id, Text, Color)
  106.   else begin
  107.     Pos := StrrPos(' ', Copy(Text, 1, 72));
  108.     if (Pos = 0) then begin
  109.       Pos := 72;
  110.       WriteConsole(Id, Copy(Text, 1, 72), Color);
  111.     end else
  112.       WriteConsole(Id, Copy(Text, 1, Pos - 1), Color);
  113.     Say(Id, Copy(Text, Pos + 1, Length(Text)), Color);
  114.   end;
  115. end;
  116.  
  117.  
  118. procedure Move(Name: string; Team: byte);
  119. var
  120.   i: byte;
  121. begin
  122.   Name := LowerCase(Name);
  123.   for i := 1 to 32 do
  124.     if (GetPlayerStat(i, 'Active') = true) then
  125.       if (((Name = '') or (ContainsString(LowerCase(GetPlayerStat(i, 'Name')), Name))) and (GetPlayerStat(i, 'Team') <> Team)) then
  126.         Command('/setteam' + InttoStr(Team) + ' ' + InttoStr(i));
  127. end;
  128.  
  129. procedure SwapTeams;
  130. var
  131.   i: byte;
  132. begin
  133.   for i := 1 to 32 do
  134.     if GetPlayerStat(i, 'Active') then
  135.       if GetPlayerStat(i, 'Team') = 1 then
  136.         Command('/setteam2 ' + inttostr(i))
  137. else
  138.       if GetPlayerStat(i, 'Team') = 2 then
  139.         Command('/setteam1 ' + inttostr(i));
  140. end;
  141.  
  142. procedure SpectateAll;
  143. var
  144.   i: byte;
  145. begin
  146.   for i := 1 to 32 do
  147.     if GetPlayerStat(i, 'Active') then
  148.       if GetPlayerStat(i, 'Team') <> 5 then
  149.         if (GetPlayerStat(i, 'Human') = true) then
  150.           Command('/setteam5 ' + inttostr(i))
  151. end;
  152.  
  153.  
  154. function GetBall(): byte;
  155. var
  156.   i: byte;
  157. begin
  158.   Result := 255;
  159.   for i := 0 to 128 do
  160.     if (GetObjectStat(i, 'Active') = true) then
  161.       if (GetObjectStat(i, 'Style') = 3) then begin
  162.         Result := i;
  163.         exit;
  164.       end;
  165. end;
  166.  
  167. procedure ReturnFlag();
  168. var
  169.   i: byte;
  170. begin
  171.   i := GetBall();
  172.   if (i <> 255) then
  173.     KillObject(i);
  174. end;
  175.  
  176.  
  177. function GamemodeName(const Gamemode: byte): string;
  178. begin
  179.   case (Gamemode) of
  180.     0:
  181.       Result := 'Deathmatch';
  182.     1:
  183.       Result := 'Pointmatch';
  184.     2:
  185.       Result := 'Team Deathmatch';
  186.     3:
  187.       Result := 'Capture the Flag';
  188.     4:
  189.       Result := 'Rambo Match';
  190.     5:
  191.       Result := 'Infiltration';
  192.     6:
  193.       Result := 'Hold the Flag';
  194.   end;
  195. end;
  196.  
  197. function TeamName(const Team: byte): string;
  198. begin
  199.   case (Team) of
  200.     0:
  201.       Result := 'Deathmatch';
  202.     1:
  203.       Result := 'Alpha';
  204.     2:
  205.       Result := 'Bravo';
  206.     3:
  207.       Result := 'Charlie';
  208.     4:
  209.       Result := 'Delta';
  210.     5:
  211.       Result := 'Spectator';
  212.   end;
  213. end;
  214.  
  215. procedure WriteConsole2(const Id: byte; const Text: string; Color: longint);
  216. begin
  217.   if (Id = 0) then begin
  218.     WriteConsole(0, Text, Color);
  219.     WriteLn(Text);
  220.   end else if (Id = 255) then
  221.     WriteLn(Text)
  222.   else if ((Id >= 1) and (Id <= 32)) then
  223.     if (GetPlayerStat(Id, 'Active') = true) then
  224.       WriteConsole(Id, Text, Color);
  225. end;
  226.  
  227.  
  228. function ScoreColor(const Team: byte): longint;
  229. begin
  230.   case (Team) of
  231.     1:
  232.       Result := $FFDF3131;
  233.     2:
  234.       Result := $FF3131DF;
  235.     else
  236.       Result := $FFFFFFFF;
  237.   end;
  238. end;
  239.  
  240. function TeamScore(const Team: byte): word;
  241. begin
  242.   case (Team) of
  243.     1:
  244.       Result := AlphaScore;
  245.     2:
  246.       Result := BravoScore;
  247.     3:
  248.       Result := CharlieScore;
  249.     4:
  250.       Result := DeltaScore;
  251.   end;
  252. end;
  253.  
  254. function Explode(Source: string; const Delimiter: string): array of string;
  255. var
  256.   Position, DelLength, ResLength: integer;
  257. begin
  258.   DelLength := Length(Delimiter);
  259.   Source := Source + Delimiter;
  260.   repeat
  261.     Position := Pos(Delimiter, Source);
  262.     SetArrayLength(Result, ResLength + 1);
  263.     Result[ResLength] := Copy(Source, 1, Position - 1);
  264.     ResLength := ResLength + 1;
  265.     Delete(Source, 1, Position + DelLength - 1);
  266.   until (Position = 0);
  267.   SetArrayLength(Result, ResLength - 1);
  268. end;
  269.  
  270. function MapsListFile(): string;
  271. begin
  272.   if (Gamemode = 6) then
  273.     Result := 'mapslistFB.txt'
  274.   else if (Gamemode = 2) then
  275.     Result := 'mapslistTM.txt'
  276.   else if (Gamemode = 3) then
  277.     Result := 'mapslist.txt';
  278. end;
  279.  
  280. function GetRandomMap(forbidden: string): string;
  281. var
  282.   MapList: array of string;
  283.   n,x: integer;
  284. begin
  285.   MapList:=Explode(ReadFile(MapsListFile()),#13#10);
  286.   n := 0;
  287.   repeat
  288.     if (n = 50) then begin
  289.       WriteLn('GetRandomMap fails');
  290.       exit;
  291.     end;
  292.     x := Random(0, GetArrayLength(MapList) - 1);
  293.     n := n + 1;
  294.   until ((MapList[x] <> '') and (MapList[x] <> forbidden));
  295.   Result := MapList[x];
  296. {
  297.   n:=GetArrayLength(MapList);
  298.   If n > 0 then
  299.     while true do begin
  300.       x:=random(0,n-1);
  301.       If MapList[x] <> forbidden then begin
  302.         result:=MapList[x];
  303.         exit;
  304.       end;
  305.     end
  306.   else
  307.     WriteLn('GetRandomMap fails');
  308. }
  309. end;
  310.  
  311.  
  312.  
  313. procedure FixScore(const Team: byte);
  314. var
  315.   i: byte;
  316. begin
  317.   AlphaAlive := false;
  318.   BravoAlive := false;
  319.   for i := 1 to 32 do
  320.     if (GetPlayerStat(i, 'Active') = true) then
  321.       if (GetPlayerStat(i, 'Alive') = true) then begin
  322.         if (GetPlayerStat(i, 'Team') = 1) then
  323.           AlphaAlive := true;
  324.         if (GetPlayerStat(i, 'Team') = 2) then
  325.           BravoAlive := true;
  326.         if ((AlphaAlive) and (BravoAlive)) then begin
  327.           StopNext := false;
  328.           exit;
  329.           end;
  330.       end;
  331.   if (AlphaAlive) and (not BravoAlive) and (Team <> 5) then begin
  332.      SetTeamScore(1, AlphaScore - 1)
  333.   end else if (BravoAlive) and (not AlphaAlive) and (Team <> 5) then begin
  334.      SetTeamScore(2, BravoScore - 1)
  335.   end;
  336. StopNext := false
  337. end;
  338.  
  339. procedure CountPlayers();
  340. var
  341.   i: byte;
  342. begin
  343.   for i := 1 to 32 do
  344.   if (GetPlayerStat(i, 'Active') = true) then
  345.         if (GetPlayerStat(i, 'Team') = 1) or (GetPlayerStat(i, 'Team') = 2) then
  346.           PlayerNumber := PlayerNumber + 1
  347. end;
  348.  
  349. procedure CountTeams();
  350. var
  351.   i: byte;
  352. begin
  353.   for i := 1 to 32 do begin
  354.   if (GetPlayerStat(i, 'Active') = true) then
  355.      if (GetPlayerStat(i, 'Alive') = true) then
  356.         if (GetPlayerStat(i, 'Team') = 1) then
  357.            AlphaNumber := AlphaNumber + 1
  358.   if (GetPlayerStat(i, 'Active') = true) then
  359.      if (GetPlayerStat(i, 'Alive') = true) then
  360.         if (GetPlayerStat(i, 'Team') = 2) then
  361.            BravoNumber := BravoNumber + 1
  362. end;
  363. end;
  364.  
  365. procedure KillAlpha();
  366. var
  367.   i: byte;
  368. begin
  369.   for i := 1 to 32 do
  370.   if (GetPlayerStat(i, 'Active') = true) then
  371.   if (GetPlayerStat(i, 'Alive') = true) then
  372.      if i <> LastKill then
  373.         DoDamage(i, 4000)
  374. end;
  375.  
  376. procedure KillBravo();
  377. var
  378.   i: byte;
  379. begin
  380.   for i := 1 to 32 do
  381.   if (GetPlayerStat(i, 'Active') = true) then
  382.   if (GetPlayerStat(i, 'Alive') = true) then
  383.      if i <> LastKill then
  384.         DoDamage(i, 4000)
  385. end;
  386.  
  387. procedure AnnounceWinner();
  388. var
  389.  i: byte;
  390. begin
  391.  for i := 1 to 32 do begin
  392.  if AlphaScore > BravoScore then
  393.  if (GetPlayerStat(i, 'Active') = true) then
  394.         if (GetPlayerStat(i, 'Team') = 1) then
  395.         Big(0, (GetPlayerStat(i, 'Name')) + ' has won!', $FFFF0000)
  396. //E15353 5353E1
  397.  if BravoScore > AlphaScore then
  398.  if (GetPlayerStat(i, 'Active') = true) then
  399.         if (GetPlayerStat(i, 'Team') = 2) then
  400.         Big(0, (GetPlayerStat(i, 'Name')) + ' has won!', $FF0000FF)
  401. end;
  402. end;
  403.  
  404.  
  405. procedure AnnounceAlpha();
  406. var
  407.  i: byte;
  408. begin
  409.   for i := 1 to 32 do
  410.     if (GetPlayerStat(i, 'Active') = true) then
  411.       if i <> LastKill then
  412.         if i <> LastDeath then
  413.         Big(i, 'Alpha team wins!', $FFFF0000);
  414. end;
  415.  
  416. procedure AnnounceBravo();
  417. var
  418.  i: byte;
  419. begin
  420.   for i := 1 to 32 do
  421.     if (GetPlayerStat(i, 'Active') = true) then
  422.       if i <> LastKill then
  423.         if i <> LastDeath then
  424.         Big(i, 'Bravo team wins!', $FF0000FF);
  425. end;
  426.  
  427. function HighestSingles(const Data: array of single): array of integer;
  428. var
  429.   i: integer;
  430. begin
  431.   if (GetArrayLength(Data) > 0) then begin
  432.     Result := [0];
  433.     if (GetArrayLength(Data) > 1) then
  434.       for i := 1 to GetArrayLength(Data) - 1 do begin
  435.         if (Data[i] > Data[Result[0]]) then
  436.           Result := [i]
  437.         else if (Data[i] = Data[Result[0]]) then begin
  438.           SetArrayLength(Result, GetArrayLength(Result) + 1);
  439.           Result[GetArrayLength(Result) - 1] := i;
  440.         end;
  441.       end;
  442.   end;
  443. end;
  444.  
  445. procedure FindMVP();
  446. var
  447.   i, j: byte;
  448.   Scores: array of single;
  449.   PlayersScores: array of byte;
  450.   MVPs: array of integer;
  451. begin
  452.   for i := 1 to 32 do
  453.     if (GetPlayerStat(i, 'Active') = true) then begin
  454.       Kills[i] := GetPlayerStat(i, 'Kills');
  455.       if (Kills[i] > 0) then begin
  456.         Deaths[i] := GetPlayerStat(i, 'Deaths');
  457.         Captures[i] := GetPlayerStat(i, 'Flags');
  458.         SetArrayLength(Scores, j + 1);
  459.         SetArrayLength(PlayersScores, j + 1);
  460.         Scores[j] := (Captures[i] + 1.0) * (Kills[i] + 1.0) / (Deaths[i] + 1.0);
  461.         PlayersScores[j] := i;
  462.         j := j + 1;
  463.       end;
  464.     end;
  465.   MVPs := HighestSingles(Scores);
  466.   if (GetArrayLength(MVPs) = 0) then
  467.     WriteConsole(0, 'No MVPs...', YieldColor)
  468.   else begin
  469.     if (GetArrayLength(MVPs) > 1) then
  470.       WriteConsole(0, 'Tie for MVP!', YieldColor);
  471.     for i := 0 to GetArrayLength(MVPs) - 1 do
  472.       WriteConsole(0, 'MVP: ' + GetPlayerStat(PlayersScores[MVPs[i]], 'Name'), YieldColor);
  473.   end;
  474. end;
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482. procedure Stop();
  483. begin
  484.   if (not Ignore) then begin
  485.     WriteConsole(0, 'Game stopped...', $FFFFFFFF);
  486.     WriteConsole(0, 'Rejoin to play CTF.', $FFFFFFFF);
  487.   end;
  488.   Command('/loadlist mapslist');
  489.   Command('/loadcon soldat.ini');
  490.   Command('/password');
  491.     if (not Ignore) then begin
  492.   GameStyle := 3
  493.   Password := ''
  494.   ActivateVariables := true;
  495.    end;
  496. end;
  497.  
  498.  
  499. procedure Start();
  500. begin
  501.   WriteConsole(0, 'Flagball starting, please rejoin...', $FFFFFFFF);
  502.   Ignore := true;
  503.   Stop();
  504.   Ignore := false;
  505.   Command('/loadlist mapslistFB');
  506.   Command('/loadcon flagball.ini');
  507.   Command('/password');
  508.   ActivateVariables := true;
  509. end;
  510.  
  511. procedure StartTM();
  512. begin
  513.   WriteConsole(0, 'Teammatch starting, please rejoin...', $FFFFFFFF);
  514.   Ignore := true;
  515.   Stop();
  516.   Ignore := false;
  517.   Command('/loadlist mapslistTM');
  518.   Command('/loadcon teammatch.ini');
  519.   Command('/password');
  520.   ActivateVariables := true;
  521. end;
  522.  
  523. function CheckPlayerLocation(const Id: byte): boolean;
  524. begin
  525.   if (GetPlayerStat(Id, 'Alive') = false) then
  526.     exit;
  527.   case (GetPlayerStat(Id, 'Team')) of
  528.     1:
  529.       Result := GetPlayerStat(Id, 'X') < -712;
  530.     2:
  531.       Result := GetPlayerStat(Id, 'X') > 712;
  532.   end;
  533.   if (Result) then begin
  534.     DisablePlayerScore[Id] := true;
  535.     DoDamage(Id, 2009);
  536.     WriteConsole(0, 'Foul! ' + GetPlayerStat(Id, 'Name') + ' inside goalie zone! Penalty: killed', FoulColor);
  537.   end;
  538. end;
  539.  
  540. function CheckFlagLocation(): byte;
  541. var
  542.   Ball: byte;
  543.   X, Y: single;
  544. begin
  545.   Ball := GetBall();
  546.   if (Ball = 255) then
  547.     exit;
  548.   X := GetObjectStat(Ball, 'X');
  549.   Y := GetObjectStat(Ball, 'Y');
  550.   if ((X >= 912) and (X <= 1072) and (Y >= 624)) then
  551.     Result := 2
  552.   else if ((X >= -1072) and (X <= -912) and (Y >= 624)) then
  553.     Result := 1;
  554.   if ((Result > 0) and (not Scored)) then begin
  555.     if (DisablePlayerScore[LastTouch]) then
  556.       WriteConsole(0, 'Foul! ' + GetPlayerStat(LastTouch, 'Name') + ' scored while inside the goalie zone. Score does not count.', FoulColor)
  557.     else if ((AccidentalScoring) or (GetPlayerStat(LastTouch, 'Team') = Result)) then begin
  558.       SetTeamScore(Result, TeamScore(Result) + 1);
  559.       WriteConsole(0, GetPlayerStat(LastTouch, 'Name') + iif(GetPlayerStat(LastTouch, 'Team') = Result, '', ' accidentally') + ' scored for ' + TeamName(Result) + ' team!', ScoreColor(Result));
  560.       if (TeamScore(Result) >= ScoreLimit) then begin
  561.         WriteConsole(0, TeamName(Result) + ' won the match!', ScoreColor(Result));
  562.         DrawTextCenter(0, TeamName(Result) + ' won the match', 300, ScoreColor(Result), 0.1875, 320, 400);
  563.         Command('/restart');
  564.       end else begin
  565.         DrawTextCenter(0, 'Score for ' + TeamName(Result) + ' team!', 250, ScoreColor(Result), 0.171875, 320, 400);
  566.         if (ReturnMessage) then
  567.           WriteConsole(0, 'Head back to the 40 yard mark, ' + TeamName(3 - Result), FoulColor);
  568.         if (ReturnOnScore) then
  569.           ReturnFlag();
  570.       end;
  571.     end;
  572.   end;
  573.   if (Scored) then begin
  574.     Scored := (X < -710) or (X > 710);
  575.     if ((not Scored) and (FlagReadyMessage)) then
  576.       WriteConsole(0, 'Flag is on the field!', FoulColor);
  577.   end else
  578.     Scored := Result > 0;
  579. end;
  580.  
  581.  
  582.  
  583.  
  584.  
  585. function OnPlayerCommand(Id: byte; Text: string): boolean;
  586. begin
  587. Result := false;
  588. if (PublicCommandsSlash) then
  589.     if ((LowerCase(Text) = '/start') or (LowerCase(Text) = '/start flagball')) then
  590.       Start()
  591.     else if (LowerCase(Text) = '/stop') then
  592.       Stop()
  593.     else if (LowerCase(Text) = '/reset') then
  594.       Command('/map ' + FlagballMap);
  595.      
  596. if (LowerCase(Copy(Text, 1, 2)) = '/ ') then begin
  597. for teami := 1 to 32 do
  598. if GetPlayerStat(teami, 'Active') then
  599. if GetPlayerStat(teami, 'Team') = GetPlayerStat(Id, 'Team') then
  600. Say(teami, '(' + TeamName(GetPlayerStat(teami, 'Team')) + ') ' + '[' + GetPlayerStat(Id, 'Name') + '] ' + Copy(Text, 3, Length(Text)), SuccessColor)
  601. WriteLn('(TEAM) ' + '[' + GetPlayerStat(Id, 'Name') + '] ' + Copy(Text, 3, Length(Text)));
  602. end;
  603.  
  604. if (LowerCase(Copy(Text, 1, 4)) = '/pm ') then begin
  605.     Result := true;
  606. pmvar := strtoint(Copy(Text, 5, 1));
  607. if GetPlayerStat(pmvar, 'Active') then begin
  608. if pmvar <> 255 then begin
  609.  WriteConsole2(Id, 'To: ' + '[' + IDToName(pmvar) + '] ' + Copy(Text, 7, Length(Text)), SuccessColor);
  610. Say(pmvar, 'From: ' + '[' + GetPlayerStat(Id, 'Name') + '] ' + Copy(Text, 7, Length(Text)), SayColor);
  611. WriteLn('PM To: ' + '[' + IDToName(pmvar) + ']' + ' From: ' + '[' + GetPlayerStat(Id, 'Name') + ']' + ': ' + Copy(Text, 7, Length(Text)));
  612. end;
  613. end else if pmvar = 255 then begin
  614. WriteLn('Error: player #' + (Copy(Text, 5, 1)) + ' does not exist.');
  615. end else if pmvar <> 255 then begin
  616. WriteConsole2(Id, 'Error: player #' + (Copy(Text, 5, 1)) + ' does not exist.', ErrorColor);
  617. end;
  618. end;
  619.  
  620.  
  621.   if (LowerCase(Text) = '/info') then begin
  622.     Result := true;
  623.     WriteConsole2(Id, ServerName + ' (' + ServerIP + ':' + InttoStr(ServerPort) + iif(PublicPassword, '/' + Password, '') + ')', SuccessColor);
  624.     WriteConsole2(Id, 'Server v' + ServerVersion + ' for Soldat v' + Version, SuccessColor);
  625.     WriteConsole2(Id, 'Gamemode: ' + GamemodeName(GameStyle), SuccessColor);
  626.     WriteConsole2(Id, 'Current Map: ' + CurrentMap + '; Next Map: ' + NextMap, SuccessColor);
  627.     WriteConsole2(Id, 'Type /server for server info', SuccessColor);
  628.   end;
  629.  
  630.   if (LowerCase(Text) = '/server') then
  631.   Greet(Id);
  632.  
  633. end;
  634.  
  635.  
  636. function OnCommand(Id: byte; Text: string): boolean;
  637. var
  638.   Team, i: byte;
  639.   Color: longint;
  640. begin
  641.   Result := false;
  642.  
  643.   if (AdminCommands) then
  644.     if ((LowerCase(Text) = '/start') or (LowerCase(Text) = '/flagball')) then
  645.       Start()
  646.     else if (LowerCase(Text) = '/stop') then
  647.       Stop()
  648.    if ((LowerCase(Text) = '/starttm') or (LowerCase(Text) = '/teammatch') or (LowerCase(Text) = '/team')) then
  649.       StartTM()
  650.    else if (LowerCase(Text) = '/ctf') then
  651.       Stop()
  652.    else if (LowerCase(Text) = '/random') then
  653.   Command('/map ' + (GetRandomMap(CurrentMap)));
  654.  
  655.  
  656.    if (LowerCase(Text) = '/mapson') then begin
  657.   MapsOnOff := true
  658. WriteConsole(0, '!map functions have been turned ON by ' + iif(Id = 255, 'ARSSE Admin', GetPlayerStat(Id, 'Name')), ErrorColor)
  659.    end else if (LowerCase(Text) = '/killon') then begin
  660.   KillAfter := true
  661. WriteConsole(0, 'After-round time has been turned OFF by ' + iif(Id = 255, 'ARSSE Admin', GetPlayerStat(Id, 'Name')), ErrorColor)
  662. WriteConsole(0, '(Players will be killed after-round)', ErrorColor)
  663.    end else if (LowerCase(Text) = '/mapsoff') then begin
  664.   MapsOnOff := false
  665. WriteConsole(0, '!map functions have been turned OFF by ' + iif(Id = 255, 'ARSSE Admin', GetPlayerStat(Id, 'Name')), ErrorColor)
  666.    end else if (LowerCase(Text) = '/killoff') then begin
  667.   KillAfter := false
  668. WriteConsole(0, 'After-round time has been turned ON by ' + iif(Id = 255, 'ARSSE Admin', GetPlayerStat(Id, 'Name')), ErrorColor)
  669. WriteConsole(0, '(Players will not be killed after-round)', ErrorColor)
  670.    end else if (LowerCase(Copy(Text, 1, 7)) = '/limit ') then begin
  671. if (Gamemode = 3) then begin
  672. Result := true
  673. Command('/limit ' + inttostr((strtoint(Copy(Text, 8, Length(Text))) + 1)))
  674. WriteConsole(0, 'Capture limit changed to ' + Copy(Text, 8, Length(Text)) + ' by ' + iif(Id = 255, 'ARSSE Admin', GetPlayerStat(Id, 'Name')), SuccessColor)
  675. WriteConsole(Id, 'Note to Admins: Ignore the yellow server message', ErrorColor)
  676. end;
  677. if (Gamemode <> 3) then
  678. WriteConsole(0, 'Capture limit changed to ' + Copy(Text, 8, Length(Text)) + ' by ' + iif(Id = 255, 'ARSSE Admin', GetPlayerStat(Id, 'Name')), SuccessColor)
  679.    end else if (LowerCase(Copy(Text, 1, 9)) = '/setscore')  then begin
  680. if Copy(Text, 10, 1) = ' ' then
  681. if (StrToInt(Copy(Text, 13, Length(Text)))) < (ScoreLimit - 1) then
  682. SetTeamScore(StrToInt(Copy(Text, 11, 1)), StrToInt(Copy(Text, 13, Length(Text))))
  683. else
  684. WriteConsole(ID, 'Please enter a value less than the capture limit', ErrorColor)
  685. else
  686. if (StrToInt(Copy(Text, 12, Length(Text)))) < (ScoreLimit - 1) then
  687. SetTeamScore(StrToInt(Copy(Text, 10, 1)), StrToInt(Copy(Text, 12, Length(Text))))
  688. else
  689. WriteConsole(ID, 'Please enter a value less than the capture limit', ErrorColor)
  690. end else if (LowerCase(Copy(Text, 1, 9)) = '/password') then begin
  691. Result := true;
  692. Command(Text);
  693. if (LowerCase(Text) = '/password') then begin
  694.       WriteConsole2(iif(PublicPassword, 0, Id), 'Password cleared', SuccessColor)
  695. Passworded := false;
  696.     end if (LowerCase(Text) <> '/password') then begin
  697.       WriteConsole2(iif(PublicPassword, 0, Id), 'Password ' + iif(Password = '', 'set', 'changed from ' + Password) + ' to ' + Copy(Text, 11, Length(Text)), SuccessColor)
  698. Passworded := true;
  699. end;
  700. end;
  701.  
  702. if (LowerCase(Text) = '/loadwep') then begin
  703.   Say(0, iif(Id = 255, '', 'Admin ') + iif(SayName, iif(Id = 255, 'ARSSE Admin', GetPlayerStat(Id, 'Name')), '') + ' has reloaded the weapons', ErrorColor);
  704. end;
  705.  
  706. if ((LowerCase(Copy(Text, 1, 6)) = '/pause') and (not Paused)) then begin
  707.     if (UnpauseCounter = 0) then begin
  708.       WriteConsole2(0, 'Game paused.', SuccessColor)
  709.     end else begin
  710.       UnpauseCounter := 0;
  711.       WriteConsole2(0, 'Game unpause countdown canceled.', SuccessColor)
  712.     end;
  713.   end else if ((LowerCase(Copy(Text, 1, 8)) = '/unpause') and (Paused)) then
  714.       WriteConsole2(0, 'Game unpaused.', $FFE739B1)
  715.   else if (LowerCase(Copy(Text, 1, 5)) = '/move') then begin
  716.     try
  717.       if (ContainsString(Text, ' ')) then
  718.         Team := StrPos(' ', Text) - 6
  719.       else
  720.         Team := Length(Text);
  721.       case (LowerCase(Copy(Text, 6, Team))) of
  722.         '0', 'dm', 'deathmatch':
  723.           Team := 0;
  724.         '1', 'a', 'alpha', 'red', 'r':
  725.           Team := 1;
  726.         '2', 'b', 'bravo', 'blue':
  727.           Team := 2;
  728.         '3', 'c', 'charlie', 'yellow', 'y':
  729.           Team := 3;
  730.         '4', 'd', 'delta', 'green', 'g':
  731.           Team := 4;
  732.         '5', 's', 'spectator', 'spectater', 'spect', 'spec':
  733.           Team := 5;
  734.         else
  735.           StrtoInt(' ');
  736.       end;
  737.     except
  738.       WriteConsole2(Id, 'Syntax: /move<team> [text]', ErrorColor);
  739.       exit;
  740.     end;
  741.     if (ContainsString(Text, ' ')) then begin
  742.       Text := Copy(Text, StrPos(' ', Text) + 1, Length(Text))
  743.       Move(Text, Team);
  744.       WriteConsole2(0, 'Moved players with "' + Text + '" to ' + TeamName(Team) + ' team.', SuccessColor);
  745.     end else begin
  746.       Move('', Team);
  747.       WriteConsole2(0, 'Everybody set to ' + TeamName(Team) + ' team.', SuccessColor);
  748.     end;
  749.  
  750.  
  751. end else if (LowerCase(Copy(Text, 1, 4)) = '/pm ') or (LowerCase(Copy(Text, 1, 4)) = '/am ') then begin
  752.     Result := true;
  753. pmvar := strtoint(Copy(Text, 5, 1));
  754. if GetPlayerStat(pmvar, 'Active') then begin
  755.  WriteConsole2(Id, 'To: ' + '[' + IDToName(pmvar) + '] ' + Copy(Text, 7, Length(Text)), SuccessColor);
  756. Say(pmvar, iif(Id = 255, '', 'Admin PM: ') + '[' + iif(SayName, iif(Id = 255, 'ARSSE PM', GetPlayerStat(Id, 'Name')), '') + '] ' + Copy(Text, 7, Length(Text)), SayColor);
  757. WriteLn('PM To: ' + '[' + IDToName(pmvar) + ']' + ' From: ' + '[' + iif(Id = 255, 'ARSSE', GetPlayerStat(Id, 'Name')) + ']' + ': ' + Copy(Text, 7, Length(Text)));
  758. end else if pmvar = 255 then begin
  759. WriteLn('Error: player #' + (Copy(Text, 5, 1)) + ' does not exist.');
  760. end else if pmvar <> 255 then begin
  761. WriteConsole2(Id, 'Error: player #' + (Copy(Text, 5, 1)) + ' does not exist.', ErrorColor);
  762. end;
  763.  
  764.   end else if (LowerCase(Copy(Text, 1, 5)) = '/say ') then begin
  765.     Result := true;
  766.     Say(0, iif(Id = 255, '', 'Admin: ') + '[' + iif(SayName, iif(Id = 255, 'ARSSE', GetPlayerStat(Id, 'Name')), '') + '] ' + Copy(Text, 6, Length(Text)), SayColor);
  767.   end else if (LowerCase(Copy(Text, 1, 4)) = '/big') then begin
  768.     Team := StrPos(' ', Text);
  769.     if (Team = 0) then
  770.       WriteConsole(Id, 'Syntax: /big[color] <message>', ErrorColor)
  771.     else begin
  772.       case (LowerCase(Copy(Text, 5, Team - 5))) of
  773.         '', 'p', 'pink', 'm', 'magenta', 'battleye', 'battleeye', 'be':
  774.           Color := $FFE739B1;
  775.         '0', 'black':
  776.           Color := $FF000000;
  777.         'white':
  778.           Color := $FFFFFFFF;
  779.         '1s':
  780.           Color := $FFFEE8E8;
  781.         '2s':
  782.           Color := $FFE3E8FE;
  783.         '3s':
  784.           Color := $FFFEFEE8;
  785.         '4s':
  786.           Color := $FFE8FEE8;
  787.         '5s':
  788.           Color := $FFDF7AB0;
  789.         'ts':
  790.           Color := $FFFEDA7C;
  791.         '1', '1j', 'red', 'r', 'alpha', 'a':
  792.           Color := $FFE15353;
  793.         '2', '2j', 'blue', 'b', 'bravo':
  794.           Color := $FF5353E1;
  795.         '3', '3j', 'yellow', 'y', 'charlie', 'c':
  796.           Color := $FFDFDF53;
  797.         '4', '4j', 'green', 'g', 'delta', 'd':
  798.           Color := $FF53DF53;
  799.         '5', '5j', 'spectator', 'spectater', 'spect', 'spec', 's':
  800.           Color := $FF52DD52;
  801.         'weaponmod', 'wm':
  802.           Color := $FFFBDA22;
  803.         'mode':
  804.           Color := $FF81DA41;
  805.         'connectionproblem', 'cp', 'problem', 'prob':
  806.           Color := $FFE36952;
  807.         'join', 'kick', 'kicked':
  808.           Color := $FFFCD822;
  809.         'nextmap', 'next', 'map', 'timeleft', 'time', 'left', 'playersleft', 'players':
  810.           Color := $FF71F981;
  811.         'welcome', 'wel', 'w':
  812.           Color := WelcomeColor;
  813.         'say':
  814.           Color := SayColor;
  815.         'success', 'suc':
  816.           Color := SuccessColor;
  817.         'yield':
  818.           Color := YieldColor;
  819.         'error':
  820.           Color := ErrorColor;
  821.         else begin
  822.           Color := $FFE739B1;
  823.           WriteConsole(Id, 'Invalid color, default being used. Try a team color or black or white for example.', ErrorColor);
  824.         end;
  825.       end;
  826.       if (BigConsole) then
  827.         WriteConsole2(0, iif(SayName, iif(Id = 255, '', 'Admin: ') + '[' + iif(Id = 255, 'ARSSE', GetPlayerStat(Id, 'Name')) + '] ', '') + Copy(Text, Team + 1, Length(Text)), Color);
  828.       Big(0, Copy(Text, Team + 1, Length(Text)), Color);
  829.     end;
  830.  
  831. end else if (LowerCase(Copy(Text, 1, 8)) = '/killmsg') then begin
  832.     Big(0, Copy(Text, 10, Length(Text)), $FFEF3431);
  833.  
  834. end else if (LowerCase(Text) = '/swap') or (LowerCase(Text) = '/swapteams') then begin
  835. SwapTeams;
  836. WriteConsole2(0, 'Teams Swapped.', SuccessColor)
  837. end else if LowerCase(Text) = '/specall' then begin
  838. SpectateAll;
  839. WriteConsole2(0, 'All players set as Spectators.', SuccessColor)
  840. end;
  841. end;
  842.  
  843.  
  844. procedure OnPlayerSpeak(Id: byte; Text: string);
  845. begin
  846.   if (PublicCommandsExcla) then
  847.     if ((LowerCase(Text) = '!start') or (LowerCase(Text) = '!start flagball')) then
  848.       Start()
  849.     else if (LowerCase(Text) = '!stop') then
  850.       Stop()
  851.     else if (LowerCase(Text) = '!reset') then
  852.       Command('/map ' + FlagballMap);
  853.  
  854.  
  855.  
  856.   if (MapsOnOff) then begin
  857.     if (LowerCase(Text) = '!maps') or (LowerCase(Text) = '!mapslist') or (LowerCase(Text) = '!maplist') then begin
  858.       Say(0, 'All gamestyle maps are able to be chosen in ' + ServerName, SuccessColor)
  859.       Say(0, 'Type !mapsDM, !mapsINF, !mapsHTF, or !mapsCTF to see a complete list', SuccessColor)
  860.     end;
  861.    
  862.     if (LowerCase(Text) = '!mapsdm') then
  863.       Say(0, 'Airpirates Arena Arena2 Arena3 Bigfalls Blox Bridge Bunker Cambodia Daybreak DesertWind Factory Flashback HH Island2k5 Jungle Krab Lagrange Leaf MrSnowman RatCave Rok Shau Tropiccave Veoto', SuccessColor)
  864.     else if (LowerCase(Text) = '!mapshtf') then
  865.       Say(0, 'htf_Arch htf_Baire htf_Boxed htf_Desert htf_Dusk htf_Erbium htf_Muygen htf_Nuclear htf_Prison htf_Rubik htf_Void htf_Zajacz', SuccessColor)
  866.     else if (LowerCase(Text) = '!mapsctf') then
  867.       Say(0, 'ctf_Amazonia ctf_Ash ctf_AshZ ctf_B2b ctf_B2bZ ctf_Blade ctf_Cobra ctf_Conquest ctf_Crashed ctf_Crashed2 ctf_Death2 ctf_DeathZ ctf_Division ctf_Dropdown2 ctf_Equinnauxe ctf_Equinox ctf_Guardian ctf_Hormone ctf_IceBeam ctf_Kampf ctf_Lanubya ctf_Lanubya2 ctf_Lanubya3 ctf_Laos ctf_LaosZ ctf_MFM2 ctf_Maya ctf_Maya2 ctf_Maya3 ctf_Nuubia ctf_Nuubia2 ctf_Paradigm ctf_Raspberry ctf_Razer ctf_Rotten ctf_Ruins ctf_RuinsZ ctf_Run ctf_Snakebite ctf_SnakebiteZ ctf_Steel ctf_Viet ctf_VietZ ctf_Voland ctf_VolandZ ctf_X', SuccessColor)
  868.     else if (LowerCase(Text) = '!mapsinf') then
  869.       Say(0, 'inf_Abel inf_Argy inf_Fortress inf_Industrial inf_Messner inf_Moonshine inf_Outpost inf_Warehouse', SuccessColor)
  870.     if (LowerCase(Text) = '!mvp') then
  871.     FindMVP();
  872.  
  873.     if Passworded = true then begin
  874.     if (LowerCase(Text) = '!nextmap') or (LowerCase(Text) = '!next') then
  875.     Command('/nextmap')
  876.     else if (LowerCase(Text) = '!res') or (LowerCase(Text) = '!restart') or (LowerCase(Text) = '!r') or (LowerCase(Text) = '!re') then
  877.     Command('/restart')
  878.     else if (LowerCase(Text) = '!p') or (LowerCase(Text) = '!pause') then
  879.     Command('/pause')
  880.     else if (LowerCase(Text) = '!up') or (LowerCase(Text) = '!unpause') then begin
  881.   //  Command('/unpause')
  882.     if (UnpauseCounterInitial = 0) then
  883.       WriteConsole2(0, 'Game unpaused.', $FFE739B1)
  884.     else
  885.       UnpauseCounter := UnpauseCounterInitial + 1;
  886.     //end;
  887.     end else if (Copy(LowerCase(Text), 1, 5) = '!map ') then
  888.       Command('/' + Copy(Text, 2, Length(Text)))
  889.     else if (LowerCase(Text) = '!random') or (LowerCase(Text) = '!rand') then
  890.   Command('/map ' + (GetRandomMap(CurrentMap)))
  891.     else if (LowerCase(Text) = '!swap') then begin
  892.   SwapTeams();
  893.   WriteConsole2(0, 'Teams Swapped.', SuccessColor)
  894.     end;
  895.     if (LowerCase(Text) = '!1') or (LowerCase(Text) = '!alpha') then
  896.     Command('/setteam1 ' + IntToStr(Id))
  897.     else if (LowerCase(Text) = '!2') or (LowerCase(Text) = '!bravo') then
  898.     Command('/setteam2 ' + IntToStr(Id))    
  899.     else if (LowerCase(Text) = '!5') or (LowerCase(Text) = '!spec') or (LowerCase(Text) = '!spectate') or (LowerCase(Text) = '!spectator') then
  900.     Command('/setteam5 ' + IntToStr(Id));
  901.  
  902. if (Gamemode = 2) then begin
  903.   if (LowerCase(Text) = '!3') or (LowerCase(Text) = '!charlie') then
  904.     Command('/setteam3 ' + IntToStr(Id))
  905.     else if (LowerCase(Text) = '!4') or (LowerCase(Text) = '!delta') then
  906.     Command('/setteam4 ' + IntToStr(Id));
  907. end;
  908. end;
  909. end;
  910. end;
  911.  
  912. procedure OnFlagScore(ID, TeamFlag: byte);
  913. begin
  914. LastKill := 0;
  915. LastDeath := 0;
  916. end;
  917.  
  918. procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
  919. begin
  920. If (GetPlayerStat(Killer, 'Team')) <> (GetPlayerStat(Victim, 'Team')) then begin
  921. LastKill := Killer
  922. LastDeath := Victim
  923. if (KillAfter) and (not CheckKillAfter) then
  924. CheckKillAfter := true;
  925. end;
  926. end;
  927.  
  928. procedure AppOnIdle(Ticks: cardinal);
  929. var
  930.   i: byte;
  931. begin
  932.  
  933. if (ActivateVariables) then begin
  934.  Gamemode := GameStyle
  935.  AlphaNumber := 0;
  936.  BravoNumber := 0;
  937.  Passworded := Password <> '';
  938.       if (Gamemode = 3) then
  939.       if Passworded = false then
  940.       KillAfter := true
  941.  if (Gamemode <> 6) then begin
  942.  MapsOnOff := true
  943.  end else begin
  944.  MapsOnOff := false
  945.  Command('/limit 6')
  946.  end;
  947. ActivateVariables := false;
  948. end;
  949.  
  950. if (CheckKillAfter) and (Gamemode = 3) then begin
  951. if (AlphaScore < (ScoreLimit - 1)) and (BravoScore < (ScoreLimit - 1)) then
  952. if NumPlayers > 1 then begin
  953. CountTeams();
  954. if AlphaNumber > 0 then
  955. if BravoNumber = 0 then
  956. KillAlpha();
  957. if AlphaNumber = 0 then
  958. if BravoNumber > 0 then
  959. KillBravo();
  960. AlphaNumber := 0
  961. BravoNumber := 0
  962. end;
  963. CheckKillAfter := false
  964. end;
  965.  
  966.  
  967.  
  968.   if (UnpauseCounter > 0) then begin
  969.     UnpauseCounter := UnpauseCounter - 1;
  970.     if (UnpauseCounter = 0) then begin
  971.       Command('/unpause');
  972.       WriteConsole2(0, 'Game unpaused.', $FFE739B1);
  973.     end else
  974.       WriteConsole2(0, 'Game unpaused in ' + InttoStr(UnpauseCounter) + '...', YieldColor);
  975.   end;
  976.  
  977.  
  978.   if (SayMap) then begin
  979.   WriteConsole(0, 'Next Map: ' + NextMap , $FF71F981);
  980.   SayMap := false;
  981.   end;
  982.  
  983.  
  984. if (Gamemode = 3) then begin
  985. if (EndGame) then
  986. if (AlphaScore = 0) and (BravoScore = 0) then
  987. EndGame := false
  988.  
  989.   if EndGame = false then
  990.     if (not StopNext) then begin
  991.       if AlphaScore >= (ScoreLimit - 1) then begin
  992.    CountPlayers();
  993.         if PlayerNumber > 2 then
  994.           AnnounceAlpha()
  995.         else
  996.           AnnounceWinner();
  997.         EndGame := true;
  998.         PlayerNumber := 0
  999.         Command('/nextmap');
  1000.       end;
  1001.         if BravoScore >= (ScoreLimit - 1) then begin
  1002.      CountPlayers();
  1003.               if PlayerNumber > 2 then
  1004.           AnnounceBravo()
  1005.         else
  1006.           AnnounceWinner();
  1007.         EndGame := true
  1008.         PlayerNumber := 0
  1009.         Command('/nextmap')
  1010.       end;
  1011.     end;
  1012. end;
  1013.  
  1014.  
  1015.   if (Gamemode = 6) then begin
  1016.     for i := 1 to 32 do
  1017.       if (GetPlayerStat(i, 'Active') = true) then
  1018.         if ((GetPlayerStat(i, 'Human') = true) and (GetPlayerStat(i, 'Name') <> BotName) and ((GetPlayerStat(i, 'Team') = 1) or (GetPlayerStat(i, 'Team') = 2))) then
  1019.           CheckPlayerLocation(i);
  1020.     CheckFlagLocation();
  1021.     if ((AutoEnd) and (NumPlayers = 0)) then
  1022.       Stop();
  1023.     if (BotName <> '') then begin
  1024.       for i := 1 to 32 do
  1025.         if (GetPlayerStat(i, 'Active') = true) then
  1026.           if ((GetPlayerStat(i, 'Human') = false) and (GetPlayerStat(i, 'Team') = 3) and (GetPlayerStat(i, 'Name') = BotName)) then
  1027.             exit;
  1028.       Command('/addbot3 ' + BotName);
  1029.     end;
  1030.   end else begin
  1031.     if (StartOnIdle) then
  1032.       Start()
  1033.     else for i := 1 to 32 do
  1034.       if (GetPlayerStat(i, 'Active') = true) then
  1035.         if ((GetPlayerStat(i, 'Human') = false) and (GetPlayerStat(i, 'Team') = 3) and (GetPlayerStat(i, 'Name') = BotName)) then
  1036.           KickPlayer(i);
  1037.   end;
  1038. end;
  1039.  
  1040. function OnPlayerDamage(Victim, Shooter: byte; Damage: integer): integer;
  1041. var
  1042.   Ticks: cardinal;
  1043. begin
  1044.   if (BotName <> '') then begin
  1045.     if ((GetPlayerStat(Victim, 'Human') = false) and (GetPlayerStat(Victim, 'Team') = 3) and (GetPlayerStat(Victim, 'Name') = BotName)) then begin
  1046.       Result := 0;
  1047.       Ticks := GetTickCount();
  1048.       if (Ticks mod AppOnIdleInterval = 0) then
  1049.         if (Ticks mod 60 <> 0) then
  1050.           AppOnIdle(Ticks);
  1051.     end else
  1052.       Result := Damage;
  1053.   end else
  1054.     Result := Damage;
  1055. end;
  1056.  
  1057. procedure OnMapChange(NewMap: string);
  1058. begin
  1059. SayMap := true;
  1060.  
  1061.   if (Gamemode = 6) then
  1062.   if (NewMap <> FlagballMap) then
  1063.     Command('/map ' + FlagballMap);
  1064. end;
  1065.  
  1066. procedure OnFlagGrab(Id, Team: byte; Base: boolean);
  1067. begin
  1068.   LastTouch := Id;
  1069. end;
  1070.  
  1071. procedure OnPlayerRespawn(Id: byte);
  1072. begin
  1073.   DisablePlayerScore[Id] := false;
  1074. end;
  1075.  
  1076.  
  1077. procedure OnJoinGame(Id, Team: byte);
  1078. begin
  1079.   Players[Id].JoinGame := true;
  1080.   if (Gamemode = 3) then
  1081.   StopNext := true;
  1082.  
  1083.  if (Gamemode = 6) then begin
  1084.    WriteConsole(Id, 'Welcome to |D) Flagball', $FFFFFFFF);
  1085.    WriteConsole(Id, 'If you are new, read the rules located above the arena', $FFFFFFFF);
  1086.  end;
  1087.  if (Gamemode = 2) then begin
  1088.    WriteConsole(Id, 'Welcome to |D) TeamMatch R/S', $FFFFFFFF);
  1089.    WriteConsole(Id, 'Choose any map: DM, HTF, CTF, etc', $FFFFFFFF);
  1090.    WriteConsole(Id, 'Kill limit is 25', $FFFFFFFF);
  1091.  end;
  1092. end;
  1093.  
  1094. procedure AfterJoinGame(Id, Team: byte);
  1095. begin
  1096. Greet(Id);
  1097. end;
  1098.  
  1099. procedure OnJoinTeam(Id, Team: byte);
  1100. begin
  1101.   if (Gamemode = 3) then
  1102.   FixScore(Team);
  1103.  
  1104.   if (Players[Id].JoinGame) then begin
  1105.     Players[Id].JoinGame := false;
  1106.     AfterJoinGame(Id, Team);
  1107.   end;
  1108.  
  1109. end;
  1110.  
  1111. procedure OnLeaveGame(Id, Team: byte; Kicked: boolean);
  1112. begin
  1113.   Players[Id].JoinGame := false;
  1114. end;
  1115.  
  1116.  
  1117.  
  1118.  
  1119. procedure ActivateServer();
  1120. begin
  1121. ActivateVariables := true;
  1122.  
  1123.   TextWidth[32] := 103.20;
  1124.   TextWidth[33] := 114.67;
  1125.   TextWidth[34] := 74.53;
  1126.   TextWidth[35] := 5.73;
  1127.   TextWidth[36] := 206.40;
  1128.   TextWidth[37] := 235.07;
  1129.   TextWidth[38] := 212.13;
  1130.   TextWidth[39] := 40.13;
  1131.   TextWidth[40] := 103.20;
  1132.   TextWidth[41] := 103.20;
  1133.   TextWidth[42] := 137.60;
  1134.   TextWidth[43] := 229.33;
  1135.   TextWidth[44] := 103.20;
  1136.   TextWidth[45] := 91.73;
  1137.   TextWidth[46] := 103.20;
  1138.   TextWidth[47] := 97.47;
  1139.   TextWidth[48] := 206.40;
  1140.   TextWidth[49] := 206.40;
  1141.   TextWidth[50] := 206.40;
  1142.   TextWidth[51] := 206.40;
  1143.   TextWidth[52] := 206.40;
  1144.   TextWidth[53] := 206.40;
  1145.   TextWidth[54] := 206.40;
  1146.   TextWidth[55] := 206.40;
  1147.   TextWidth[56] := 206.40;
  1148.   TextWidth[57] := 206.40;
  1149.   TextWidth[58] := 103.20;
  1150.   TextWidth[59] := 103.20;
  1151.   TextWidth[60] := 229.33;
  1152.   TextWidth[61] := 229.33;
  1153.   TextWidth[62] := 229.33;
  1154.   TextWidth[63] := 177.73;
  1155.   TextWidth[64] := 275.20;
  1156.   TextWidth[65] := 200.67;
  1157.   TextWidth[66] := 212.13;
  1158.   TextWidth[67] := 206.40;
  1159.   TextWidth[68] := 223.60;
  1160.   TextWidth[69] := 194.93;
  1161.   TextWidth[70] := 177.73;
  1162.   TextWidth[71] := 223.60;
  1163.   TextWidth[72] := 235.07;
  1164.   TextWidth[73] := 97.47;
  1165.   TextWidth[74] := 183.47;
  1166.   TextWidth[75] := 200.67;
  1167.   TextWidth[76] := 177.73;
  1168.   TextWidth[77] := 246.53;
  1169.   TextWidth[78] := 229.33;
  1170.   TextWidth[79] := 235.07;
  1171.   TextWidth[80] := 200.67;
  1172.   TextWidth[81] := 235.07;
  1173.   TextWidth[82] := 212.13;
  1174.   TextWidth[83] := 212.13;
  1175.   TextWidth[84] := 160.53;
  1176.   TextWidth[85] := 223.60;
  1177.   TextWidth[86] := 189.20;
  1178.   TextWidth[87] := 235.07;
  1179.   TextWidth[88] := 194.93;
  1180.   TextWidth[89] := 183.47;
  1181.   TextWidth[90] := 189.20;
  1182.   TextWidth[91] := 103.20;
  1183.   TextWidth[92] := 97.47;
  1184.   TextWidth[93] := 103.20;
  1185.   TextWidth[94] := 275.20;
  1186.   TextWidth[95] := 137.60;
  1187.   TextWidth[96] := 137.60;
  1188.   TextWidth[97] := 172;
  1189.   TextWidth[98] := 172;
  1190.   TextWidth[99] := 172;
  1191.   TextWidth[100] := 200.67;
  1192.   TextWidth[101] := 160.53;
  1193.   TextWidth[102] := 149.07;
  1194.   TextWidth[103] := 183.47;
  1195.   TextWidth[104] := 189.20;
  1196.   TextWidth[105] := 74.53;
  1197.   TextWidth[106] := 154.80;
  1198.   TextWidth[107] := 166.27;
  1199.   TextWidth[108] := 149.07;
  1200.   TextWidth[109] := 206.40;
  1201.   TextWidth[110] := 189.20;
  1202.   TextWidth[111] := 189.20;
  1203.   TextWidth[112] := 166.27;
  1204.   TextWidth[113] := 189.20;
  1205.   TextWidth[114] := 166.27;
  1206.   TextWidth[115] := 177.73;
  1207.   TextWidth[116] := 143.33;
  1208.   TextWidth[117] := 183.47;
  1209.   TextWidth[118] := 160.53;
  1210.   TextWidth[119] := 200.67;
  1211.   TextWidth[120] := 160.53;
  1212.   TextWidth[121] := 154.80;
  1213.   TextWidth[122] := 172;
  1214.   TextWidth[123] := 137.60;
  1215.   TextWidth[124] := 137.60;
  1216.   TextWidth[125] := 137.60;
  1217.   TextWidth[126] := 229.33;
  1218.   TextWidth[127] := 166.27;
  1219.   StartOnIdle := AutoStart;
  1220. end;
Add Comment
Please, Sign In to add comment