Player::disableVoiceTo: Difference between revisions
(Created page with "{{ServerSide}} This function is used to disable voice listening to a certain player. == Syntax == <pre> player.disableVoiceTo(Player player) </pre> == Examples == This ex...") |
(Added C# Serverside Method; Improve the looks thanks to beast containers) |
||
| Line 1: | Line 1: | ||
{{ | This function is used to disable voice listening to a certain player. | ||
{{ServersideCsJsFunction}} | |||
{{CSharpContainer| | |||
<pre> | |||
player.DisableVoiceTo(Client target); | |||
</pre> | |||
{{Parameters}} | |||
* '''target''': The Player you want to stop listen to. | |||
{{Example}} | |||
<syntaxhighlight lang="c#"> | |||
[Command("stoplistento")] | |||
public void StopListenToTarget(Client player, Client target) | |||
{ | |||
player.DisableVoiceTo(target); | |||
//If you want it to be bidirectional | |||
target.DisableVoiceTo(player); | |||
} | |||
</syntaxhighlight> | |||
}} | |||
{{JSContainer| | |||
<pre> | <pre> | ||
player.disableVoiceTo(Player player) | player.disableVoiceTo(Player player) | ||
</pre> | </pre> | ||
{{Parameters}} | |||
* '''player''': The Player you want to stop listen to. | |||
{{Example}} | |||
This example below disables all players from hearing the player with ID '0'. | This example below disables all players from hearing the player with ID '0'. | ||
< | <syntaxhighlight lang="javascript"> | ||
let player = mp.players.at(0); | let player = mp.players.at(0); | ||
| Line 21: | Line 42: | ||
player.disableVoiceTo(_player); | player.disableVoiceTo(_player); | ||
}); | }); | ||
</ | </syntaxhighlight> | ||
}} | |||
== See Also == | == See Also == | ||
Revision as of 06:37, 26 November 2019
This function is used to disable voice listening to a certain player.
Server-Side Function
C# Syntax
player.DisableVoiceTo(Client target);
Parameters
- target: The Player you want to stop listen to.
Example
[Command("stoplistento")]
public void StopListenToTarget(Client player, Client target)
{
player.DisableVoiceTo(target);
//If you want it to be bidirectional
target.DisableVoiceTo(player);
}
JavaScript Syntax
player.disableVoiceTo(Player player)
Parameters
- player: The Player you want to stop listen to.
Example
This example below disables all players from hearing the player with ID '0'.
let player = mp.players.at(0);
mp.players.forEach((_player) => {
if(player == _player) return false;
player.disableVoiceTo(_player);
});