Eliminating Combine Balls

I want a script that blows up/severely harms (40-50 dmg) the user of the AR2 when they fire the Combine Ball.

Basically, they try to fire it, and after it finishes the charge up, right as it would come out, it just blows up right in their face and gives them the damage.

But don’t make it so all combine balls do that. I still want NPCs to be able to fire 'em at me.

This is simply because I find the Combine Ball fucking annoying/stupid and since the game gives you like six, you can just keep shooting them all over, die, get more, etc. and it’d help me out a ton.



local EXPLODE_DAMAGE 	= 32	--How much damage the explosion should do.		Default: 32

local function OnEntityCreated( ent )
	local effect, pl

	if ValidEntity( ent ) and ent:GetClass( ) == "prop_combine_ball" then
		pl = ent:GetOwner( )

		if ValidEntity( pl ) and pl:IsPlayer( ) then
			pl:TakeDamage( EXPLODE_DAMAGE, pl )

			effect = EffectData( )
				effect:SetOrigin( ent:GetPos( ) )
				effect:SetScale( 12 )
				effect:SetMagnitude( 2 )
			util.Effect( "cball_explode", effect )

			ent:Fire( "explode" )
		end
	end
		
end

hook.Add( "OnEntityCreated", "Ball Detonator.On Entity Created", OnEntityCreated )


Goes in autorun/server.

Awesome. Thanks!