Skip to content

Commit

Permalink
Update Events.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
daffyyyy committed Oct 19, 2024
1 parent bff8a72 commit a6b9982
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,15 +256,17 @@ private HookResult OnPlayerDeath(EventPlayerDeath @event, GameEventInfo info)
if (victim == null || !victim.IsValid || victim == player)
return HookResult.Continue;

if (!GPlayerWeaponsInfo.TryGetValue(player.Slot, out _)) return HookResult.Continue;
if (!GPlayerWeaponsInfo.TryGetValue(player.Slot, out var teamInfo) ||
!teamInfo.TryGetValue(player.Team, out var teamWeapons) )
return HookResult.Continue;

CBasePlayerWeapon? weapon = player.PlayerPawn.Value?.WeaponServices?.ActiveWeapon.Value;

if (weapon == null) return HookResult.Continue;

int weaponDefIndex = weapon.AttributeManager.Item.ItemDefinitionIndex;

if (!GPlayerWeaponsInfo[player.Slot][player.Team].TryGetValue(weaponDefIndex, out var weaponInfo) || weaponInfo.Paint == 0)
if (!teamWeapons.TryGetValue(weaponDefIndex, out var weaponInfo) || weaponInfo.Paint == 0)
return HookResult.Continue;

if (!weaponInfo.StatTrak) return HookResult.Continue;
Expand Down

0 comments on commit a6b9982

Please sign in to comment.