Player::enableVoiceTo: Difference between revisions

From RAGE Multiplayer Wiki
(Looks beast now)
Line 1: Line 1:
{{ServerSide}}
{{Serverside}}


This function is used to enable voice listening to a certain player.
This function is used to enable voice listening to a certain player.


== Syntax ==


{{JSContainer|
 
{{CSharpContainer|
<pre>
<pre>
player.enableVoiceTo(Player player)
Player.EnableVoiceTo(Client target);
</pre>
</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>
}}
}}
{{CSharpContainer|
 
{{JSContainer|
<pre>
<pre>
Player.EnableVoiceTo(Client player);
player.enableVoiceTo(Player player)
</pre>
</pre>
}}


== Examples ==
{{Parameters}}
* '''player''': The Player you want to listen to.


{{JSContainer|
{{Example}}
{{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 31: Line 45:
         player.enableVoiceTo(_player);
         player.enableVoiceTo(_player);
});
});
</syntaxhighlight>
}}
{{CSharpContainer|
{{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>
</syntaxhighlight>
}}
}}


== See Also ==
== See Also ==

Revision as of 06:14, 26 November 2019

Player::enableVoiceTo

This function is used to enable voice listening to a certain player.



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);
});


See Also