Prevent the weapon from shooting when pointing at invalid model. See #1 for more info on invalid model.

master
Icedream 2013-12-21 04:17:33 +01:00
parent e5a04781bf
commit d54d2465e1
1 changed files with 7 additions and 1 deletions

View File

@ -278,10 +278,16 @@ function SWEP:PrimaryAttack()
return false
end
// Make sure the new model is actually marked as a prop
if (
string.sub(string.lower(entity:GetClass()), 1, 5) != "prop_"
&& string.sub(string.lower(entity:GetClass()), -5, -1) != "_prop"
&& string.find(string.lower(entity:GetClass()), "_prop_") == nil
) then return false end
// Now let's disguise, shall we?
self:DoShootEffect(trace.HitPos, trace.HitNormal, trace.Entity, trace.PhysicsBone, IsFirstTimePredicted())
self:Disguise(entity)
end
// this is usually triggered on right mouse click