Glass Break Code

I’m working on a weapon that shatters all glass within a 30 foot radius, the problem is I can’t think of a way to have it do that without using something like a controlled explosion. Someone suggested that I should use the shatter command

but I have no idea how to implement this. any help would be appreciated on where and how to do this.

Locate all window entities in the radius using ents.FindInSphere and use Entity.Fire to fire the shatter input.

Sounds about right but how do I implement that? Sorry I’m really bad with programming.

[lua]for k, v in pairs( ents.FindInSphere(self.Owner:GetPos(), 30*HOW MUCH IS A FEET IN UNITS) ) do
if( v:GetClass() == “CLASSOFGLASSENTITY”)then

Thats exactly what Quebec said, I’m just not sure if it’s the right fire.

func_breakable or func_breakable_surf, I’m not sure which one it is.


And does that go under the primary attack function or some other function? And what do I replace with units? 30HOW MUCH IS A FEET IN UNITS, or just the HOW MUCH IS A FEET IN UNITS leaving the 30?

func_Breakable_surf is the one that will shatter in shards and the func_breakable is the one that just breaks.

But does it go under the function SWEP:PrimaryAttack() or what?

30 Feet = 540 Units