diff --git a/EXILED/Exiled.CustomRoles/API/Features/CustomRole.cs b/EXILED/Exiled.CustomRoles/API/Features/CustomRole.cs index 51e4ac008..61f88ec2c 100644 --- a/EXILED/Exiled.CustomRoles/API/Features/CustomRole.cs +++ b/EXILED/Exiled.CustomRoles/API/Features/CustomRole.cs @@ -537,6 +537,16 @@ public virtual void AddRole(Player player) Log.Debug($"{Name}: Adding {itemName} to inventory."); TryAddItem(player, itemName); } + + if (Ammo.Count > 0) + { + Log.Debug($"{Name}: Adding Ammo to {player.Nickname} inventory."); + foreach (AmmoType type in EnumUtils.Values) + { + if (type != AmmoType.None) + player.SetAmmo(type, Ammo.ContainsKey(type) ? Ammo[type] == ushort.MaxValue ? InventoryLimits.GetAmmoLimit(type.GetItemType(), player.ReferenceHub) : Ammo[type] : (ushort)0); + } + } }); Log.Debug($"{Name}: Setting health values."); @@ -910,25 +920,6 @@ private void OnInternalChangingRole(ChangingRoleEventArgs ev) { RemoveRole(ev.Player); } - else if (Check(ev.Player)) - { - Log.Debug($"{Name}: Checking ammo stuff {Ammo.Count}"); - if (Ammo.Count > 0) - { - Log.Debug($"{Name}: Clearing ammo"); - ev.Ammo.Clear(); - Timing.CallDelayed( - 0.5f, - () => - { - foreach (AmmoType type in Enum.GetValues(typeof(AmmoType))) - { - if (type != AmmoType.None) - ev.Player.SetAmmo(type, Ammo.ContainsKey(type) ? Ammo[type] == ushort.MaxValue ? InventoryLimits.GetAmmoLimit(type.GetItemType(), ev.Player.ReferenceHub) : Ammo[type] : (ushort)0); - } - }); - } - } } private void OnSpawningRagdoll(SpawningRagdollEventArgs ev)