Player.SetMuted

From GMod Wiki

Jump to: navigation, search
Function
Syntax Player:SetMuted( Boolean )
Description:
This function toggles the muted state on the client's muted list.
Returns: nil
In Object: Player
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Player.SetMuted]Player.SetMuted [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionSimple function to ignore a single player.
Used onNewerClient.png
Code
function IgnorePlayer(ply)
    ply:SetMuted(true);
end
function UnignorePlayer(ply)
    ply:SetMuted(false);
end
OutputN/A




DescriptionSimple voice chat radius script.
Used onNewerClient.png
Code
 
VC_MAX_RADIUS = 120
timer.Create( "VoiceChatRadius", 1, 0, function()
	local lpl = LocalPlayer();
	for _,ply in ipairs(player:GetAll()) do
		if (ply ~= lpl) then
			if (ply:GetPos():Distance(lpl:GetPos()) <= VC_MAX_RADIUS) then
				ply:SetMuted(false);
			else
				ply:SetMuted(true);
			end
		end
	end
end)
 
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox