Player::enableVoiceTo: Difference between revisions
(Created page with "{{ServerSide}} This function is used to enable voice listening to a certain player. == Syntax == <syntaxhighlight lang="javascript"> player.enableVoiceTo(Player player) </s...") |
No edit summary |
||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
This function is used to enable voice listening to a certain player. | |||
{{ServersideCsJsFunction}} | |||
{{CSharpContainer| | |||
<pre> | |||
player.EnableVoiceTo(Client target); | |||
</pre> | |||
{{Parameters}} | |||
* '''target''': The Player you want to listen to. | |||
{{Example}} | |||
<syntaxhighlight lang="c#"> | |||
[Command("listento")] | |||
public void ListenToTarget(Client player, Client target) | |||
{ | |||
player.EnableVoiceTo(target); | |||
//If you want it to be bidirectional | |||
target.EnableVoiceTo(player); | |||
} | |||
</syntaxhighlight> | |||
}} | |||
< | {{JSContainer| | ||
<pre> | |||
player.enableVoiceTo(Player player) | player.enableVoiceTo(Player player) | ||
</ | </pre> | ||
{{Parameters}} | |||
* '''player''': The Player you want to listen to. | |||
{{Example}} | |||
This example below shows how all players can hear the player with ID "0". | This example below shows how all players can hear the player with ID "0". | ||
| Line 22: | Line 45: | ||
}); | }); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
}} | |||
== See Also == | == See Also == | ||
Latest revision as of 06:40, 27 November 2019
This function is used to enable voice listening to a certain player.
Server-Side Function
C# Syntax
player.EnableVoiceTo(Client target);
Parameters
- target: The Player you want to listen to.
Example
[Command("listento")]
public void ListenToTarget(Client player, Client target)
{
player.EnableVoiceTo(target);
//If you want it to be bidirectional
target.EnableVoiceTo(player);
}
JavaScript Syntax
player.enableVoiceTo(Player player)
Parameters
- player: The Player you want to listen to.
Example
This example below shows how all players can hear the player with ID "0".
let player = mp.players.at(0);
mp.players.forEach((_player) => {
if(player == _player) return false;
player.enableVoiceTo(_player);
});