From f47f249b24609d20b18ab3a4d3fd3be5f8f4c6e3 Mon Sep 17 00:00:00 2001 From: MSWS Date: Sat, 3 Feb 2024 14:15:05 -0800 Subject: [PATCH] Fix dict functions, add repeat flag --- mod/Jailbreak.Rebel/RebelManager.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mod/Jailbreak.Rebel/RebelManager.cs b/mod/Jailbreak.Rebel/RebelManager.cs index 15b46289..4d680e3a 100644 --- a/mod/Jailbreak.Rebel/RebelManager.cs +++ b/mod/Jailbreak.Rebel/RebelManager.cs @@ -1,6 +1,7 @@ using System.Drawing; using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core.Attributes.Registration; +using CounterStrikeSharp.API.Modules.Timers; using Jailbreak.Public.Behaviors; using Jailbreak.Public.Mod.Rebel; @@ -29,7 +30,7 @@ public void Start(BasePlugin parent) ApplyRebelColor(player); } - }); + }, TimerFlags.REPEAT); } HookResult OnPlayerDisconnect(EventPlayerDisconnect @event, GameEventInfo info) @@ -59,7 +60,7 @@ public float GetRebelTimeLeft(CCSPlayerController player) public bool MarkRebel(CCSPlayerController player, float time) { - rebelTimes.Add(player, DateTime.Now.Ticks / 1000f + time); + rebelTimes[player] = DateTime.Now.Ticks / 1000f + time; ApplyRebelColor(player); return true; } @@ -87,6 +88,7 @@ private void ApplyRebelColor(CCSPlayerController player) if (!player.IsValid || player.Pawn.Value == null) return; var percentage = GetRebelTimePercentage(player); + player.PrintToConsole("Rebel percentage: " + percentage); var inverse = 1 - percentage; var inverseInt = (int)(inverse * 255); var color = Color.FromArgb(254, (int)percentage * 255, inverseInt, inverseInt);