I noticed a pretty full autokit we have set up for a "purge" event wasn't being applied on player respawn.
After a bit of digging it looked like CanClaimKit was failing at HasSpaceForItems.
Since this is a respawn autokit and the next step is player.inventory.Strip() I tried adding an extra parameter to CanClaimKit which solved my issue -
diff --git a/Kits.cs b/Kits.cs
index 03da270..546ad88 100644
--- a/Kits.cs
+++ b/Kits.cs
@@ -86,7 +86,7 @@ namespace Oxide.Plugins
if (!kitData.Find(Configuration.AutoKits[i], out kit))
continue;
- object success = CanClaimKit(player, kit, true);
+ object success = CanClaimKit(player, kit, true, true);
if (success != null)
continue;
@@ -149,7 +149,7 @@ namespace Oxide.Plugins
return true;
}
- private object CanClaimKit(BasePlayer player, KitData.Kit kit, bool ignoreAuthCost = false)
+ private object CanClaimKit(BasePlayer player, KitData.Kit kit, bool ignoreAuthCost = false, bool ignoreInventory = false)
{
object success = Interface.Oxide.CallDeprecatedHook("canRedeemKit", "CanRedeemKit", _deprecatedHookTime, player) ?? Interface.Oxide.CallHook("CanRedeemKit", player);
if (success != null)
@@ -198,7 +198,7 @@ namespace Oxide.Plugins
}
}
- if (!kit.HasSpaceForItems(player))
+ if (!ignoreInventory && !kit.HasSpaceForItems(player))
return Message("Error.CanClaim.InventorySpace", player.userID);
if (!ignoreAuthCost && kit.Cost > 0)
Not sure if there's a better way to contribute. I hope this helps.
Thanks