Skip to content
This repository was archived by the owner on Jan 25, 2025. It is now read-only.

Commit 6c54827

Browse files
committed
feat: Option to reset killstreaks for alive players
1 parent d903d9a commit 6c54827

File tree

6 files changed

+34
-18
lines changed

6 files changed

+34
-18
lines changed

CHANGELOG

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
-- 2023.04.13 - V4.1.3
2+
3+
- feat: Option to reset killstreaks for alive players
4+
- fix: Top command not prints properly
5+
- fix: Points for dying not working
6+
17
-- 2023.04.12 - V4.1.2
28

39
- fix: AutoPurge query
10+
- fix: RoundStart error log (#166)
11+
- fix: Delete invalid players on save-all
12+
- fix: RankTop not updating instantly (#166)
13+
- fix: RankTop position display problems (#166)
414

515
-- 2023.04.11 - V4.1.1
616

K4-System/src/Module/Rank/RankCommands.cs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -178,28 +178,31 @@ public void OnCommandTop(CCSPlayerController? player, CommandInfo info)
178178

179179
Task.Run(async () =>
180180
{
181+
await plugin.SaveAllPlayersDataAsync();
181182
List<(int points, string name)>? rankData = await FetchTopDataAsync(printCount);
182183

183-
if (rankData?.Count > 0)
184+
Server.NextFrame(() =>
184185
{
185-
for (int i = 0; i < rankData.Count; i++)
186+
if (!k4player.IsValid || !k4player.IsPlayer)
187+
return;
188+
189+
if (rankData?.Count > 0)
186190
{
187-
int points = rankData[i].points;
188-
string name = rankData[i].name;
191+
for (int i = 0; i < rankData.Count; i++)
192+
{
193+
int points = rankData[i].points;
194+
string name = rankData[i].name;
189195

190-
Rank rank = GetPlayerRank(points);
196+
Rank rank = GetPlayerRank(points);
191197

192-
Server.NextFrame(() =>
193-
{
194-
player!.PrintToChat($" {plugin.Localizer["k4.ranks.top.line", i + 1, rank.Color, rank.Name, name, points]}");
195-
});
198+
k4player.Controller.PrintToChat($" {plugin.Localizer["k4.ranks.top.line", i + 1, rank.Color, rank.Name, name, points]}");
199+
}
196200
}
197-
198-
}
199-
else
200-
{
201-
player!.PrintToChat($" {plugin.Localizer["k4.general.prefix"]} {plugin.Localizer["k4.ranks.top.notfound", printCount]}");
202-
}
201+
else
202+
{
203+
k4player.Controller.PrintToChat($" {plugin.Localizer["k4.general.prefix"]} {plugin.Localizer["k4.ranks.top.notfound", printCount]}");
204+
}
205+
});
203206
});
204207
}
205208

K4-System/src/Module/Rank/RankEvents.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public void Initialize_Events()
169169

170170
K4Player? k4attacker = plugin.GetK4Player(@event.Attacker);
171171

172-
if (!k4victim.IsPlayer)
172+
if (k4victim.IsPlayer)
173173
{
174174
k4victim.KillStreak = (0, DateTime.Now);
175175

K4-System/src/Module/Rank/RankFunctions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void BeforeRoundEnd(int winnerTeam)
3838
if (!k4player.IsValid || !k4player.IsPlayer)
3939
continue;
4040

41-
if (!k4player.Controller.PawnIsAlive)
41+
if (!k4player.Controller.PawnIsAlive || Config.RankSettings.KillstreakResetOnRoundEnd)
4242
k4player.KillStreak = (0, DateTime.Now);
4343

4444
RankData? playerData = k4player.rankData;

K4-System/src/Plugin/PluginConfig.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ public sealed class StatisticSettings
159159

160160
public sealed class RankSettings
161161
{
162+
[JsonPropertyName("killstreak-reset-on-round-end")]
163+
public bool KillstreakResetOnRoundEnd { get; set; } = false;
164+
162165
[JsonPropertyName("start-points")]
163166
public int StartPoints { get; set; } = 0;
164167

K4-System/src/Plugin/PluginManifest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public sealed partial class Plugin : BasePlugin
1010

1111
public override string ModuleAuthor => "K4ryuu";
1212

13-
public override string ModuleVersion => "4.1.2 " +
13+
public override string ModuleVersion => "4.1.3 " +
1414
#if RELEASE
1515
"(release)";
1616
#else

0 commit comments

Comments
 (0)