First you should know that “ply” is just an arbitrary name that someone used to keep a reference to an object, in this case an entity that is also a player. Entities have a number of methods which can be used on them including EmitSound. So to get a player to emit sound you will first need to grab a reference to it’s object and then use the method on it.
Now that this is out of the way, : **[Entity.EmitSound
http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Entity.EmitSound)** emits sound from the entity and it is only audible within a certain radius.
As to detecting when a player shoots… well the closest and simplest thing would be detecting when they press Mouse 1, which can be accomplished with the following untested code :
if key == IN_ATTACK then
– Code here