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...") |
No edit summary |
||
| (One intermediate revision by one other user not shown) | |||
| 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.disableVoiceTo(Player target) | ||
</pre> | </pre> | ||
{{Parameters}} | |||
* '''target''': 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 == | ||
Latest revision as of 01:41, 19 February 2020
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 target)
Parameters
- target: 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);
});