Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- StopNext, EndGame, SayMap, AlphaAlive, BravoAlive: boolean;
- HighestID, LastKill, LastDeath, AlphaNumber, BravoNumber: byte;
- TextWidth : array[32..127] of single;
- Procedure SetHighestID();
- var
- i: byte;
- begin
- for i := 1 to 32 do
- if (HighestID < i) then
- if (GetPlayerStat(i, 'Active') = true) then
- HighestID := i
- end;
- procedure DrawTextCenter(const Id: byte; Text: string; const Delay: integer; const Color: longint; const Scale: single; const XCoord, YCoord: integer);
- var
- i, c : byte;
- TotalWidth, Width, Height : single;
- begin
- TotalWidth := 0;
- Width := 0;
- Height := 202;
- for i := 1 to length(Text) do begin
- c := ord(Text[i]);
- if ((c > 31) and (c < 128)) then begin
- Width := Width + TextWidth[c];
- if (Width > TotalWidth) then
- TotalWidth := Width;
- end else if (c = 13) then begin
- Height := Height + 202;
- Width := 0;
- end;
- end;
- DrawText(ID, Copy(Text, 1, 58) + iif(Length(Text) <= 3, ' ', ''), Delay, Color, Scale, XCoord - Round(TotalWidth * Scale / 2), YCoord - Round(Height * Scale / 2));
- end;
- procedure Big(const Id: byte; const Text: string; const Color: longint);
- var
- Size: single;
- begin
- Size := 3.5 / Length(Text);
- if (Size > 0.33) then
- Size := 0.33;
- DrawTextCenter(Id, Text, 9 * Length(Text) + 85, Color, Size, 320, 360);
- end;
- procedure SwapTeams;
- var
- i: byte;
- begin
- for i := 1 to HighestID do
- if GetPlayerStat(i, 'Active') then
- if GetPlayerStat(i, 'Team') = 1 then
- Command('/setteam2 ' + inttostr(i))
- else
- if GetPlayerStat(i, 'Team') = 2 then
- Command('/setteam1 ' + inttostr(i));
- end;
- procedure FixScore(const Team: byte);
- var
- i: byte;
- begin
- AlphaAlive := false;
- BravoAlive := false;
- for i := 1 to HighestID do
- if (GetPlayerStat(i, 'Active') = true) then
- if (GetPlayerStat(i, 'Alive') = true) then begin
- if (GetPlayerStat(i, 'Team') = 1) then
- AlphaAlive := true;
- if (GetPlayerStat(i, 'Team') = 2) then
- BravoAlive := true;
- if ((AlphaAlive) and (BravoAlive)) then begin
- StopNext := false;
- exit;
- end;
- end;
- if (AlphaAlive) and (not BravoAlive) and (Team <> 5) then begin
- SetTeamScore(1, AlphaScore - 1)
- end else if (BravoAlive) and (not AlphaAlive) and (Team <> 5) then begin
- SetTeamScore(2, BravoScore - 1)
- end;
- StopNext := false
- end;
- function CountPlayers(): byte;
- var
- i: byte;
- begin
- for i := 1 to HighestID do
- if (GetPlayerStat(i, 'Active') = true) and (GetPlayerStat(i, 'Team') < 5) then
- Result := Result + 1
- end;
- procedure CountTeams();
- var
- i: byte;
- begin
- AlphaNumber := 0
- BravoNumber := 0
- for i := 1 to HighestID do begin
- if (GetPlayerStat(i, 'Active') = true) then
- if (GetPlayerStat(i, 'Alive') = true) then
- if (GetPlayerStat(i, 'Team') = 1) then
- AlphaNumber := AlphaNumber + 1
- else if (GetPlayerStat(i, 'Team') = 2) then
- BravoNumber := BravoNumber + 1
- end;
- end;
- function GetName(const Id: byte): string;
- begin
- if Id = 255 then
- Result := 'ARSSE Admin'
- else
- Result := GetPlayerStat(Id, 'Name')
- end;
- procedure AnnounceWinner();
- var
- i: byte;
- begin
- for i := 1 to HighestID do begin
- if AlphaScore > BravoScore then
- if (GetPlayerStat(i, 'Active') = true) then
- if (GetPlayerStat(i, 'Team') = 1) then
- Big(0, (GetPlayerStat(i, 'Name')) + ' has won!', $FFFF0000);
- //E15353 5353E1
- if BravoScore > AlphaScore then
- if (GetPlayerStat(i, 'Active') = true) then
- if (GetPlayerStat(i, 'Team') = 2) then
- Big(0, (GetPlayerStat(i, 'Name')) + ' has won!', $FF0000FF)
- end;
- end;
- procedure AnnounceAlpha();
- var
- i: byte;
- begin
- for i := 1 to HighestID do
- if (GetPlayerStat(i, 'Active') = true) then
- if i <> LastKill then
- if i <> LastDeath then
- Big(i, 'Alpha team wins!', $FFFF0000);
- end;
- procedure AnnounceBravo();
- var
- i: byte;
- begin
- for i := 1 to HighestID do
- if (GetPlayerStat(i, 'Active') = true) then
- if i <> LastKill then
- if i <> LastDeath then
- Big(i, 'Bravo team wins!', $FF0000FF);
- end;
- function OnCommand(Id: byte; Text: string): boolean;
- begin
- Result := false
- if (LowerCase(Copy(Text, 1, 7)) = '/limit ') then begin
- Result := true
- Command('/limit ' + inttostr((strtoint(Copy(Text, 8, Length(Text))) + 1)))
- WriteConsole(0, 'Capture limit changed to ' + Copy(Text, 8, Length(Text)) + ' by ' + GetName(Id), $FF0FA0C6)
- if Id <> 255 then WriteConsole(Id, 'Note to Admins: Ignore the yellow server message', $FFBF7F7F)
- end;
- if (LowerCase(Copy(Text, 1, 9)) = '/setscore') then begin
- if Copy(Text, 10, 1) = ' ' then
- if (StrToInt(Copy(Text, 13, Length(Text)))) < (ScoreLimit - 1) then
- SetTeamScore(StrToInt(Copy(Text, 11, 1)), StrToInt(Copy(Text, 13, Length(Text))))
- else
- WriteConsole(ID, 'Please enter a value less than the capture limit', $FFBF7F7F)
- else
- if (StrToInt(Copy(Text, 12, Length(Text)))) < (ScoreLimit - 1) then
- SetTeamScore(StrToInt(Copy(Text, 10, 1)), StrToInt(Copy(Text, 12, Length(Text))))
- else
- WriteConsole(ID, 'Please enter a value less than the capture limit', $FFBF7F7F)
- end
- end;
- function OnPlayerCommand(ID: Byte; Text: string): boolean;
- begin
- if Copy(Text, 1, 3) = '/ds' then
- WriteLn('DMGHACK' + ' [' + GetPlayerStat(Id, 'Name') + '] ' + Text)
- end;
- procedure OnPlayerSpeak(Id: byte; Text: string);
- begin
- if (LowerCase(Text) = '!swap') then begin
- SwapTeams();
- WriteConsole(0, 'Teams Swapped.', $FF0FA0C6)
- end;
- end;
- procedure OnFlagScore(ID, TeamFlag: byte);
- begin
- CountTeams();
- if (AlphaNumber > 0) then
- if (BravoNumber = 0) then begin
- SetTeamScore(1, AlphaScore - 1)
- if (CountPlayers > 1) then begin
- if (CountPlayers <> AlphaNumber) then
- WriteConsole(0, 'Double Captures have been disabled and have no effect', $FFFF0000)
- else
- WriteConsole(0, 'There is no enemy team', $FFFF0000)
- end else
- WriteConsole(ID, 'Stop playing with yourself loser', $FFFF0000)
- end;
- if (BravoNumber > 0) then
- if (AlphaNumber = 0) then begin
- SetTeamScore(2, BravoScore - 1)
- if CountPlayers > 1 then begin
- if CountPlayers <> BravoNumber then
- WriteConsole(0, 'Double Captures have been disabled and have no effect', $FF0000FF)
- else
- WriteConsole(0, 'There is no enemy team', $FF0000FF)
- end else
- WriteConsole(ID, 'Stop playing with yourself loser', $FF0000FF)
- end;
- end;
- procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
- begin
- If (GetPlayerStat(Killer, 'Team')) <> (GetPlayerStat(Victim, 'Team')) then begin
- LastKill := Killer
- LastDeath := Victim
- end;
- end;
- procedure AppOnIdle(Ticks: cardinal);
- var
- i: byte;
- begin
- if (SayMap) then begin
- WriteConsole(0, 'Next Map: ' + NextMap , $FF71F981);
- SayMap := false;
- end;
- if (EndGame) then
- if (AlphaScore = 0) and (BravoScore = 0) then
- EndGame := false;
- if EndGame = false then
- if (not StopNext) then begin
- if AlphaScore >= (ScoreLimit - 1) then begin
- if CountPlayers > 2 then
- AnnounceAlpha()
- else
- AnnounceWinner();
- EndGame := true;
- Command('/nextmap');
- end;
- if BravoScore >= (ScoreLimit - 1) then begin
- if CountPlayers > 2 then
- AnnounceBravo()
- else
- AnnounceWinner();
- EndGame := true
- Command('/nextmap')
- end
- end
- end;
- procedure OnJoinGame(Id, Team: byte);
- begin
- HighestID := 1
- SetHighestID();
- StopNext := true;
- end;
- procedure OnJoinTeam(Id, Team: byte);
- begin
- FixScore(Team);
- end;
- procedure OnLeaveGame(Id, Team: byte; Kicked: boolean);
- begin
- if Id = HighestID then begin
- HighestID := 1
- SetHighestID();
- end;
- end;
- procedure OnMapChange(NewMap: string);
- begin
- SayMap := true;
- end;
- procedure ActivateServer();
- begin
- SetHighestID();
- TextWidth[32] := 103.20;
- TextWidth[33] := 114.67;
- TextWidth[34] := 74.53;
- TextWidth[35] := 5.73;
- TextWidth[36] := 206.40;
- TextWidth[37] := 235.07;
- TextWidth[38] := 212.13;
- TextWidth[39] := 40.13;
- TextWidth[40] := 103.20;
- TextWidth[41] := 103.20;
- TextWidth[42] := 137.60;
- TextWidth[43] := 229.33;
- TextWidth[44] := 103.20;
- TextWidth[45] := 91.73;
- TextWidth[46] := 103.20;
- TextWidth[47] := 97.47;
- TextWidth[48] := 206.40;
- TextWidth[49] := 206.40;
- TextWidth[50] := 206.40;
- TextWidth[51] := 206.40;
- TextWidth[52] := 206.40;
- TextWidth[53] := 206.40;
- TextWidth[54] := 206.40;
- TextWidth[55] := 206.40;
- TextWidth[56] := 206.40;
- TextWidth[57] := 206.40;
- TextWidth[58] := 103.20;
- TextWidth[59] := 103.20;
- TextWidth[60] := 229.33;
- TextWidth[61] := 229.33;
- TextWidth[62] := 229.33;
- TextWidth[63] := 177.73;
- TextWidth[64] := 275.20;
- TextWidth[65] := 200.67;
- TextWidth[66] := 212.13;
- TextWidth[67] := 206.40;
- TextWidth[68] := 223.60;
- TextWidth[69] := 194.93;
- TextWidth[70] := 177.73;
- TextWidth[71] := 223.60;
- TextWidth[72] := 235.07;
- TextWidth[73] := 97.47;
- TextWidth[74] := 183.47;
- TextWidth[75] := 200.67;
- TextWidth[76] := 177.73;
- TextWidth[77] := 246.53;
- TextWidth[78] := 229.33;
- TextWidth[79] := 235.07;
- TextWidth[80] := 200.67;
- TextWidth[81] := 235.07;
- TextWidth[82] := 212.13;
- TextWidth[83] := 212.13;
- TextWidth[84] := 160.53;
- TextWidth[85] := 223.60;
- TextWidth[86] := 189.20;
- TextWidth[87] := 235.07;
- TextWidth[88] := 194.93;
- TextWidth[89] := 183.47;
- TextWidth[90] := 189.20;
- TextWidth[91] := 103.20;
- TextWidth[92] := 97.47;
- TextWidth[93] := 103.20;
- TextWidth[94] := 275.20;
- TextWidth[95] := 137.60;
- TextWidth[96] := 137.60;
- TextWidth[97] := 172;
- TextWidth[98] := 172;
- TextWidth[99] := 172;
- TextWidth[100] := 200.67;
- TextWidth[101] := 160.53;
- TextWidth[102] := 149.07;
- TextWidth[103] := 183.47;
- TextWidth[104] := 189.20;
- TextWidth[105] := 74.53;
- TextWidth[106] := 154.80;
- TextWidth[107] := 166.27;
- TextWidth[108] := 149.07;
- TextWidth[109] := 206.40;
- TextWidth[110] := 189.20;
- TextWidth[111] := 189.20;
- TextWidth[112] := 166.27;
- TextWidth[113] := 189.20;
- TextWidth[114] := 166.27;
- TextWidth[115] := 177.73;
- TextWidth[116] := 143.33;
- TextWidth[117] := 183.47;
- TextWidth[118] := 160.53;
- TextWidth[119] := 200.67;
- TextWidth[120] := 160.53;
- TextWidth[121] := 154.80;
- TextWidth[122] := 172;
- TextWidth[123] := 137.60;
- TextWidth[124] := 137.60;
- TextWidth[125] := 137.60;
- TextWidth[126] := 229.33;
- TextWidth[127] := 166.27;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement