Merge pull request #40 from CFC-Servers/fix/null-weapon-error

Fix NULL weapon error
This commit is contained in:
NullLikesNothing 2023-10-15 18:40:13 -05:00 committed by GitHub
commit 76c435dd7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -211,7 +211,8 @@ local function spawnProtectionKeyPressCheck( ply, keyCode )
return
end
if attackKeys[keyCode] and not weaponIsAllowed( ply:GetActiveWeapon() ) then
local plyActiveWeapon = ply:GetActiveWeapon()
if attackKeys[keyCode] and plyActiveWeapon:IsValid() and not weaponIsAllowed( plyActiveWeapon ) then
instantRemoveSpawnProtection( ply, "You've attacked and lost spawn protection." )
end
end