diff --git a/Modules/Managers/AllocationManager.cs b/Modules/Managers/AllocationManager.cs index e68984d..c6a8fef 100644 --- a/Modules/Managers/AllocationManager.cs +++ b/Modules/Managers/AllocationManager.cs @@ -35,7 +35,6 @@ private static void AllocateWeapons(CCSPlayerController player) if (player.Team == CsTeam.Terrorist) { player.GiveNamedItem(CsItem.AK47); - // player.GiveNamedItem(CsItem.Glock); player.GiveNamedItem(CsItem.Deagle); } @@ -51,7 +50,6 @@ private static void AllocateWeapons(CCSPlayerController player) player.GiveNamedItem(CsItem.M4A1S); } - // player.GiveNamedItem(CsItem.USPS); player.GiveNamedItem(CsItem.Deagle); } diff --git a/RetakesPlugin.cs b/RetakesPlugin.cs index bfeb881..1221d8e 100644 --- a/RetakesPlugin.cs +++ b/RetakesPlugin.cs @@ -17,7 +17,7 @@ namespace RetakesPlugin; [MinimumApiVersion(154)] public class RetakesPlugin : BasePlugin { - private const string Version = "1.3.30"; + private const string Version = "1.3.31"; #region Plugin info public override string ModuleName => "Retakes Plugin"; @@ -636,7 +636,7 @@ public HookResult OnRoundPostStart(EventRoundPoststart @event, GameEventInfo inf Helpers.WriteLine($"{LogPrefix}Trying to loop valid active players."); foreach (var player in _gameManager.QueueManager.ActivePlayers.Where(Helpers.IsValidPlayer)) { - Helpers.WriteLine($"{LogPrefix}[{player.PlayerName}] Adding timer for allocation..."); + Helpers.WriteLine($"{LogPrefix}[{player.PlayerName}] Handling allocation..."); if (!Helpers.IsValidPlayer(player)) { @@ -646,34 +646,26 @@ public HookResult OnRoundPostStart(EventRoundPoststart @event, GameEventInfo inf // Strip the player of all of their weapons and the bomb before any spawn / allocation occurs. Helpers.RemoveHelmetAndHeavyArmour(player); player.RemoveWeapons(); - - // Create a timer to do this as it would occasionally fire too early. - AddTimer(0.05f, () => + + if (player == _planter && RetakesConfig.IsLoaded(_retakesConfig) && + !_retakesConfig!.RetakesConfigData!.IsAutoPlantEnabled) { - if (!Helpers.IsValidPlayer(player)) - { - Helpers.WriteLine($"{LogPrefix}Allocating weapons: Player is not valid."); - return; - } - - if (player == _planter && RetakesConfig.IsLoaded(_retakesConfig) && - !_retakesConfig!.RetakesConfigData!.IsAutoPlantEnabled) - { - Helpers.WriteLine($"{LogPrefix}Player is planter and auto plant is disabled, allocating bomb."); - Helpers.GiveAndSwitchToBomb(player); - } + Helpers.WriteLine($"{LogPrefix}Player is planter and auto plant is disabled, allocating bomb."); + Helpers.GiveAndSwitchToBomb(player); + } - if (!RetakesConfig.IsLoaded(_retakesConfig) || - _retakesConfig!.RetakesConfigData!.EnableFallbackAllocation) - { - Helpers.WriteLine($"{LogPrefix}Allocating..."); - AllocationManager.Allocate(player); - } - else - { - Helpers.WriteLine($"{LogPrefix}Fallback allocation disabled, skipping."); - } - }); + if (!RetakesConfig.IsLoaded(_retakesConfig) || + _retakesConfig!.RetakesConfigData!.EnableFallbackAllocation) + { + Helpers.WriteLine($"{LogPrefix}Allocating..."); + AllocationManager.Allocate(player); + } + else + { + Helpers.WriteLine($"{LogPrefix}Fallback allocation disabled, skipping."); + + // TODO: Once shared apis are implemented into CounterStrikeSharp then notify allocators to allocate. + } } return HookResult.Continue;