Skip to content

Commit e985397

Browse files
authored
Merge pull request #303 from MrDave1999/dev
9.5.4 Release
2 parents 2efdfc5 + 30cf5f1 commit e985397

File tree

7 files changed

+23
-11
lines changed

7 files changed

+23
-11
lines changed

.env.example

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ServerInfo__GameModeText=CTF/Team Deathmatch [v9]
44
ServerInfo__MapName=RC_Battlefield
55
ServerInfo__WebUrl=https://github.com/MrDave1999/Capture-The-Flag
66
ServerInfo__IntroAudioUrl=https://od.lk/s/Nl8yMDg4MTc0NDBf/intro-cs.mp3
7+
ServerInfo__HeadshotAudioUrl=https://od.lk/s/Nl8yMTE2ODQ3MTVf/headshot.mp3
78
# Expressed in seconds.
89
ServerInfo__FlagAutoReturnTime=120
910

@@ -53,7 +54,8 @@ BlueTeamScoresUrl=https://od.lk/s/Nl8yMDg4MTc0MzJf/blue_team_scores.mp3
5354
#
5455
# Primary keys used by docker-compose
5556
#
56-
MaxPlayers=30 # Number of players that can enter the SA-MP Server
57+
ServerPassword=
58+
MaxPlayers=30 # Number of players that can enter the SA-MP Server
5759
LagCompMode=1 # Lag Compensation
5860
Port=7777 # The port to be published by the container
5961
TZ=America/Bogota # Time Zone

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ services:
77
bash -c "sed -i 's/lagcompmode 1/lagcompmode ${LagCompMode}/' server.cfg
88
&& sed -i 's/maxplayers 30/maxplayers ${MaxPlayers}/' server.cfg
99
&& sed -i 's/port 7777/port ${Port}/' server.cfg
10+
&& sed -i 's/^password/password ${ServerPassword}/' server.cfg
1011
&& ./omp-server"
1112
ports:
1213
- ${Port}:${Port}/udp

server.cfg.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ gamemode0 empty 1
55
plugins libSampSharp.so streamer.so
66
filterscripts
77
rcon_password password
8+
password
89
port 7777
910
hostname [CTF] Capture The Flag | TDM
1011
maxplayers 30

src/Application/Common/Resources/Messages.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Application/Common/Resources/Messages.resx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
<value>This round was won by the Beta team</value>
158158
</data>
159159
<data name="BlueFlagIsNotAtBasePosition" xml:space="preserve">
160-
<value>~n~~n~~n~~b~The blue flag is not at its base position</value>
160+
<value>~n~~n~~b~Your blue flag has been taken!~n~Recover it before the enemy scores!</value>
161161
</data>
162162
<data name="ChatDisabled" xml:space="preserve">
163163
<value>Chat is currently disabled while you select your class. Please finish your selection before chatting!</value>
@@ -415,7 +415,7 @@
415415
<value>{PlayerName} redeemed their coins for the combo: {ComboName}</value>
416416
</data>
417417
<data name="RedFlagIsNotAtBasePosition" xml:space="preserve">
418-
<value>~n~~n~~n~~r~The red flag is not at its base position</value>
418+
<value>~n~~n~~r~Your red flag has been taken!~n~Recover it before the enemy scores!</value>
419419
</data>
420420
<data name="ReportSuccessfullySent" xml:space="preserve">
421421
<value>You have successfully sent the report</value>

src/Application/Common/Settings/ServerSettings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ public class ServerSettings
88
public string MapName { get; init; } = string.Empty;
99
public string WebUrl { get; init; } = string.Empty;
1010
public string IntroAudioUrl { get; init; } = string.Empty;
11+
public string HeadshotAudioUrl { get; init; } = string.Empty;
1112
public int FlagAutoReturnTime { get; init; } = 120;
1213
}

src/Application/Players/HeadShotSystem.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
public class HeadShotSystem(
44
IPlayerRepository playerRepository,
5-
IWorldService worldService) : ISystem
5+
IWorldService worldService,
6+
ServerSettings serverSettings) : ISystem
67
{
78
/// <summary>
89
/// This callback is called when a player takes damage.
910
/// </summary>
10-
/// <param name="player">
11+
/// <param name="receiver">
1112
/// The player that took damage.
1213
/// </param>
1314
/// <param name="issuer">
@@ -23,7 +24,7 @@ public class HeadShotSystem(
2324
/// The <see href="https://www.open.mp/docs/scripting/resources/bodyparts">body part</see> that was hit.
2425
/// </param>
2526
[Event]
26-
public void OnPlayerTakeDamage(Player player, Player issuer, float amount, Weapon weapon, BodyPart bodyPart)
27+
public void OnPlayerTakeDamage(Player receiver, Player issuer, float amount, Weapon weapon, BodyPart bodyPart)
2728
{
2829
if (issuer.IsInvalidPlayer())
2930
return;
@@ -33,17 +34,23 @@ public void OnPlayerTakeDamage(Player player, Player issuer, float amount, Weapo
3334
issuer.PlaySound(soundId: 17802);
3435
}
3536

36-
if (issuer.Team != player.Team && weapon == Weapon.Sniper && bodyPart == BodyPart.Head)
37+
if (issuer.Team != receiver.Team && weapon == Weapon.Sniper && bodyPart == BodyPart.Head)
3738
{
3839
PlayerInfo issuerInfo = issuer.GetInfo();
40+
PlayerInfo receiverInfo = receiver.GetInfo();
3941
issuerInfo.AddHeadShots();
4042
issuerInfo.StatsPerRound.AddCoins(5);
4143
playerRepository.UpdateHeadShots(issuerInfo);
42-
player.Health = 0;
44+
receiver.Health = 0;
45+
if (!receiverInfo.HasCapturedFlag())
46+
{
47+
issuer.PlayAudioStream(serverSettings.HeadshotAudioUrl);
48+
receiver.PlayAudioStream(serverSettings.HeadshotAudioUrl);
49+
}
4350
var message = Smart.Format(Messages.HeadshotToPlayer, new
4451
{
4552
PlayerName1 = issuer.Name,
46-
PlayerName2 = player.Name
53+
PlayerName2 = receiver.Name
4754
});
4855
worldService.SendClientMessage(Color.Yellow, message);
4956
}

0 commit comments

Comments
 (0)