Player::disableVoiceTo: Difference between revisions

From RAGE Multiplayer Wiki
(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:
{{ServerSide}}
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.


This function is used to disable voice listening to a certain player.
{{Example}}
<syntaxhighlight lang="c#">
[Command("stoplistento")]
public void StopListenToTarget(Client player, Client target)
{
    player.DisableVoiceTo(target);


== Syntax ==
    //If you want it to be bidirectional
    target.DisableVoiceTo(player);
}
</syntaxhighlight>
}}


{{JSContainer|
<pre>
<pre>
player.disableVoiceTo(Player player)
player.disableVoiceTo(Player target)
</pre>
</pre>


== Examples ==
{{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'.


<pre>
<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);
});
});
</pre>
</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#  JavaScript



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


See Also