Skip to content

Commit

Permalink
Fix dict functions, add repeat flag
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Feb 3, 2024
1 parent fa6987f commit f47f249
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mod/Jailbreak.Rebel/RebelManager.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -29,7 +30,7 @@ public void Start(BasePlugin parent)

ApplyRebelColor(player);
}
});
}, TimerFlags.REPEAT);
}

HookResult OnPlayerDisconnect(EventPlayerDisconnect @event, GameEventInfo info)
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f47f249

Please sign in to comment.