# setPlayerMutedInVoiceChannel (Server)

> Mutes a player in a voice channel: they still hear the channel, but nobody hears them through it.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Server
- **Category**: Voice
- **URL**: https://wiki.mymp.gg/en/setPlayerMutedInVoiceChannel

## Syntax

```lua
bool setPlayerMutedInVoiceChannel(element channel, player player, bool muted)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `channel` | `element` | The channel, from `createVoiceChannel`. |
| `player` | `player` | The player. |
| `muted` | `bool` | `true` to mute, `false` to be heard again. |

## Returns

`true` if it was changed, `false` if the player is not in the channel.

## Example

```lua
local lobby = createVoiceChannel(0, 0)

addCommandHandler("mute", function(admin, command, name)
    local target = getPlayerFromName(name)
    if target then
        setPlayerMutedInVoiceChannel(lobby, target, true)
    end
end)
```

## See also

- [setPlayerDeafInVoiceChannel (Server)](https://wiki.mymp.gg/en/setPlayerDeafInVoiceChannel.md): Deafens a player in a voice channel: the others still hear them, but they hear nobody through that channel.
- [setPlayerVoiceIgnoreFrom (Server)](https://wiki.mymp.gg/en/setPlayerVoiceIgnoreFrom.md): Makes a player stop hearing the voice of certain elements, in every channel.
- [addPlayerToVoiceChannel (Server)](https://wiki.mymp.gg/en/addPlayerToVoiceChannel.md): Puts a player in a voice channel. From then on they hear and are heard by the others in the channel.
