Player::enableVoiceTo: Difference between revisions

From RAGE Multiplayer Wiki
(Looks beast now)
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{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.


{{ServersideCsJsFunction}}




{{CSharpContainer|
{{CSharpContainer|
<pre>
<pre>
Player.EnableVoiceTo(Client target);
player.EnableVoiceTo(Client target);
</pre>
</pre>



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#  JavaScript




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