Making a Glass Breaker

Hello, I know this a repeat of a question I had in the Newbie Questions Forums but with a few exceptions nobody over there was helpful. I need a SWEP that shatters all glass within a 30 foot radius without explosions or harming players. It doesn’t need to be dramatic it just had to break. One of the few helpful posters gave me this code:


for k, v in pairs( ents.FindInSphere(self.Owner:GetPos(), 30*HOW MUCH IS A FEET IN UNITS) ) do  
     if( v:GetClass() == "func_breakable")then  
          v:Fire("shatter");  
     end;  
end;

but I still have a few questions.

  1. Where does it go? The Primary Attack Function or somewhere else?

  2. I’ve found the units I’ll use (270) and I want to know do I replace just HOW MUCH IS A FEET IN UNITS or the whole 30*HOW MUCH IS A FEET IN UNITS?

Any Help Is Appreciated

when editing player size, 12 units is a foot, but when talking map units 18 units is a foot.

Don’t know anything about lua though so can’t help you further :&.

P.S you might want to change the thread title, sounds like you need help to make something that can “just” break glass, which a crowbar does just fine.

Thank you for the clarification on the units (I’ll use 540) and I’ll change the title to be more descriptive.