aboutsummaryrefslogtreecommitdiff
path: root/gamemode/shared/weaponswap.lua
diff options
context:
space:
mode:
authorApickx <apickx@cogarr.com>2018-03-05 21:00:54 -0500
committerApickx <apickx@cogarr.com>2018-03-05 21:00:54 -0500
commit9722802672a6edba9f7dd8f6a435a02284691925 (patch)
treeda3b0760d8b774aaed92c8b0f6e75493a53ec10d /gamemode/shared/weaponswap.lua
parentc08b42e3f24d8ee274f39ce49fda2add029886d0 (diff)
downloadwintersurvival2-9722802672a6edba9f7dd8f6a435a02284691925.tar.gz
wintersurvival2-9722802672a6edba9f7dd8f6a435a02284691925.tar.bz2
wintersurvival2-9722802672a6edba9f7dd8f6a435a02284691925.zip
Fixed a bug where clients would sometimes error when switching weapons
Diffstat (limited to 'gamemode/shared/weaponswap.lua')
-rw-r--r--gamemode/shared/weaponswap.lua10
1 files changed, 3 insertions, 7 deletions
diff --git a/gamemode/shared/weaponswap.lua b/gamemode/shared/weaponswap.lua
index b409f5a..0ee7376 100644
--- a/gamemode/shared/weaponswap.lua
+++ b/gamemode/shared/weaponswap.lua
@@ -25,12 +25,8 @@ if (CLIENT) then
surface.PlaySound("wintersurvival2/hud/itemequip.wav")
if (IsValid(Wep)) then
- if (pl.Weapons and pl.Weapons[Num] and pl.Weapons[Num].Item and pl.Weapons[Num].Item.HoldType) then
- print("Setting holdtype to", pl.Weapons[Num].Item.HoldType)
- Wep:SetHoldType(pl.Weapons[Num].Item.HoldType)
- else
- Wep:SetHoldType("normal")
- end
+ if (pl.Weapons and pl.Weapons[Num] and pl.Weapons[Num].Item and pl.Weapons[Num].Item.HoldType) then Wep:SetWeaponHoldType(pl.Weapons[Num].Item.HoldType)
+ else Wep:SetWeaponHoldType("normal") end
end
return true
@@ -45,7 +41,7 @@ if (CLIENT) then
surface.PlaySound("wintersurvival2/hud/itemequip.wav")
if (IsValid(Wep)) then
- if (pl.Weapons and pl.Weapons[Num]) then Wep:SetWeaponHoldType(pl.Weapons[Num].Item.HoldType)
+ if (pl.Weapons and pl.Weapons[Num] and pl.Weapons[Num].Item and pl.Weapons[Num].Item.HoldType) then Wep:SetWeaponHoldType(pl.Weapons[Num].Item.HoldType)
else Wep:SetWeaponHoldType("normal") end
end