Player::disableVoiceTo: Difference between revisions

From RAGE Multiplayer Wiki
(Added C# Serverside Method; Improve the looks thanks to beast containers)
No edit summary
 
Line 25: Line 25:
{{JSContainer|
{{JSContainer|
<pre>
<pre>
player.disableVoiceTo(Player player)
player.disableVoiceTo(Player target)
</pre>
</pre>


{{Parameters}}
{{Parameters}}
* '''player''': The Player you want to stop listen to.
* '''target''': The Player you want to stop listen to.


{{Example}}
{{Example}}

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