Stop NPC Weapon Drop

So i have a pretty shitty swrp server im working on and when you kill a NPC it drops the weapon that the NPC was using, therefore if i walk over it i will pick up the weapon. I would like it so the weapon is not picked up, i do not mind how this is achieved i would just like to have it so the guns and ammo (If you can) are not picked up. I found a 2 ‘functions’? on the gmod wiki but i am not entirely sure on where to put them and how to implement them. The hook and function and below

hook.Add( “PlayerCanPickupWeapon”, “noDoublePickup”, function( ply, wep )
if ( ply:HasWeapon( wep:GetClass() ) ) then return false end
end )

function GM:PlayerCanPickupWeapon( ply, wep )
return ( wep:GetClass() == “weapon_pistol” )
end

Use the hook for this. The GM is only if you want to make your own gamemode.

Just put it in garrysmod/lua/autorun/server and name it whatever you want but make sure it has .lua on the end and it should work.

GM hooks aren’t only if you want to create your own game-mode… You can use those hooks to alter the behavior without creating a GM - many authors do this.

But, be careful, many authors also make the error of always returning a value… you only do this if you want your hook to take control in 100% of the scenarios, even ones you aren’t targeting…

Take a look at:

That may work on bots… Otherwise you can edit the weapon base to prevent dropping if the owner was a bot - this will allow the weapons to work as normal, except they simply won’t be dropped.

There are likely countless other solutions.