EmitSound how to change volume?


-- Called at an interval while a player is connected.
function PLUGIN:PlayerThink(player, curTime, infoTable)
	local CrematorSound = "npc/cremator/amb_loop.wav"
	local sound = CreateSound(player, "npc/cremator/amb_loop.wav");
	local faction = player:GetFaction();

	if (player:Alive() and !player:IsRagdolled()) then
			if ( faction == FACTION_CREMATOR ) then
		-- player:EmitSound(CrematorSound, 65, 50);
		sound:Play();
	else
		-- BroadcastLua("LocalPlayer():ConCommand('stopsound')") Doesn't fukin work
		sound:Stop();
			end;
		end;
end;

lets say I have this on:


player:EmitSound(CrematorSound, 65, 50);

btw I only know (SOUND, whatsthat, whatsthat) one of them should be the sound and one range I guess but I dont know.

I want to change the volume serversided so me and otherplayer will hear this but some people complained that its too loud so I want to create a command to change the volume. But I don’t want that all Cremators gets the same volume when someone types the command to change the volume.
If someone changes his cremator volume ONLY his cremator should have that volume.

How can I do that?

And whats the client side way?

First and foremost, the wiki can answer the “what’s what” question:

Entity:EmitSound

For what you asked, I suggest that you make the server send broadcast a net message to all players, then each player will emit the sound from the entity clientside with his/her personal volume.

However, if many of your players are complaining that it’s too loud, then maybe it really is too loud - have you considered trying to find a volume that everyone is happy with?

– BroadcastLua(“LocalPlayer():ConCommand(‘stopsound’)”)

So I change this somehow?