Change GMOD death sound?

Is there a way to change the death sound from the regular sound to something else so it replaces it on my server only?

Return true in

GM:PlayerDeathSound to mute the default death sound
Play sound using

Entity:EmitSound in any death hook (

GM:PlayerDeath,

GM:PostPlayerDeath,

GM:DoPlayerDeath)
(serverside)

Thanks! So where do I put all this? Is it a console command or do I put it in the config

In a serverside script, in your gamemode, add-on or lua/autorun/server/

Could you give me an example of this code?


function GM:EntityTakeDamage(ply, info)
	if(ply:Health() < 1) then
		ply:EmitSound(string.format("player/death%d.wav", math.random(1, 6)), 100, 100, 1, CHAN_BODY);
	end
end

function GM:PlayerDeathSound()
	return true;
end