Voice chat Dead /Alive

Is there a way to setup a gmod server with a plugin or by default so the dead can hear everyone but when they talk on their mic only the dead can hear them?


(User was banned for this post ("why reply" - OvB))

That might be a little more helpful than “yes”
There may also be addons that do this for you, but I do not know of any.

If this hasn’t been solved yet here’s an example on how you could do it:

function GM:PlayerCanHearPlayersVoice(ply, rec)   
	if ( !ply:Alive() ) and ( !rec:Alive() ) then -- If they are both dead they can hear each other.
		return true
	elseif ( ply:Alive() ) and ( rec:Alive() ) then	-- If they are both alive they can hear each other.
		return true
	else -- If they are not either both alive or dead then they can't hear each other.
		return false

Sorry for the late response I forgot I posted this haha. Anyway I’m kind of a noob to scripting lua but would I save the above code as voicechataddon.lua and place it in my servers autorun?

Thanks in advance,

I don’t use the autorun in includes I use addons.

You could make it an addon by putting a folder in addons and then within that folder have a lua folder that contains all of the files. Then you make an autorun folder and then have a file within that folder that would be automatically run.

In the file that you autorun you’ll have to do include(‘filename.lua’) since that code I gave you a while back is serverside. This will also make it easy for you to just add other files with AddCSLuaFile or include if you choose to use other code and want to run it alongside.