FA:S 2.0 weapon bullet penetration: how do I disable it?

(addon)

I’m using these weapons for my DarkRP server, but the bullet penetration will get in the way, as bullets can penetrate doors, “protected” windows, most props, and even some map walls (I use rp_downtown_v4_exl).
I’ve seen many people ask the same question, but none were given an answer. I only found one thread with multiple solutions, but none of them worked for me.

Someone said that making a new lua file in “addons/fas_weapons/lua/autorun/” with this code will fix it, and it actually worked for somebody. But not me:


hook.Add( "PlayerSwitchWeapon", "DisableOverPenetration", function( _p, _oldW, _w )
 	if ( IsValid( _p ) && IsValid( _w ) ) then _w.PenetrationEnabled = false; end
end );

From what I’ve seen going through most of the FA:S files, there’s no simple on/off switch for penetration.

Can I get some help from people to please tell me step by step how to disable the guns shooting through doors, “protected” windows, most props, and map walls? Thanks in advance guys!

Contact the author; we’d have to decompile the addon and look through code we’re not familiar with.

Try the other method I provided in your original post.

edit: seems like someone else posted it… 1 sec…

http://forum.facepunch.com/showthread.php?t=1452898

addons/acecool/lua/autorun/sh_disable_fas_over_penetration.lua


hook.Add( "PlayerSwitchWeapon", "DisableOverPenetration", function( _p, _oldW, _w )
	if ( IsValid( _p ) && IsValid( _w ) ) then
		_w.PenetrationEnabled	= false;
		_w.RicochetEnabled	= false;
	end
end );

or


hook.Add( "Initialize", "PreventOverPenetrationAndRicochet", function( )
	for k, _tab in pairs( weapons.GetList( ) ) do
		_tab.PenetrationEnabled	= false;
		_tab.RicochetEnabled	= false;
	end
end );

or both… The Initialize modifies all weapons in the table by setting penetration and ricochet to false. The PlayerSwitchWeapon ensures that each time a player switches the weapon, the server and client will update the variable for that particular weapon. You can comment out or remove the line for ricochet if you only want to disable penetration.

Added both to a new file and it works.

Thanks, Acecool!