VoiceChat.defaultVolume: Difference between revisions

From RAGE Multiplayer Wiki
(Created page with "{{ClientsideJsFunction}} {{JSContainer| ===Required Params=== *'''volume:''' {{RageType|number}} ===Return value=== *''' {{RageType|number}} ''' ==Syntax== <syntaxhighlight lang="javascript"> mp.voiceChat.defaultVolume = volume; </syntaxhighlight> ==Example== <syntaxhighlight lang="javascript"> //todo </syntaxhighlight> }} ==See Also== *Functions: **mp.voiceChat.getPreprocessingParam **voiceChat.setPreprocessingParam|mp.voiceChat...")
 
No edit summary
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:


===Required Params===
===Required Params===
*'''volume:''' {{RageType|number}}
*'''volume:''' {{RageType|number}} — The desired volume level for the voice chat (0 to 1).


===Return value===
===Return value===
*''' {{RageType|number}} '''
*'''void''' — This function does not return a value.


==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
mp.voiceChat.defaultVolume = volume;
// Function to set the voice chat volume
</syntaxhighlight>
function setVoiceChatVolume() {
    let volume = 0.5; // Set the desired volume level (0 = muted, 1 = maximum)
   
    // Set the default voice chat volume
    mp.voiceChat.defaultVolume = volume;
 
    // Notify the player that the voice chat volume has been set
    mp.gui.chat.push("Voice chat volume set to: " + volume);
}


==Example==
// Bind the function to a key (the "E" key)
<syntaxhighlight lang="javascript">
mp.keys.bind(69, false, function() { // 69 is the key code for "E"
//todo
    setVoiceChatVolume(); // Call the function to change the voice chat volume
});
</syntaxhighlight>
</syntaxhighlight>
}}
}}
==See Also==
 
*Functions:
==See also==
**[[voiceChat.getPreprocessingParam|mp.voiceChat.getPreprocessingParam]]
{{VoiceChat_functions_c}}
**[[voiceChat.setPreprocessingParam|mp.voiceChat.setPreprocessingParam]]
[[Category:Clientside API]]
*Properties:
[[Category:TODO: Example]]
**[[voiceChat.gameOutputEnabled|mp.voiceChat.gameOutputEnabled]]
**[[voiceChat.gameOutputCategory|mp.voiceChat.gameOutputCategory]]
**[[voiceChat.lastVad|mp.voiceChat.lastVad]]
**[[voiceChat.minVad|mp.voiceChat.minVad]]
**[[voiceChat.muted|mp.voiceChat.muted]]
**[[voiceChat.defaultVolume|mp.voiceChat.defaultVolume]]

Latest revision as of 20:47, 6 October 2024

Client-Side
Function

 JavaScript



JavaScript Syntax


Required Params

  • volume: number — The desired volume level for the voice chat (0 to 1).

Return value

  • void — This function does not return a value.

Syntax

// Function to set the voice chat volume
function setVoiceChatVolume() {
    let volume = 0.5; // Set the desired volume level (0 = muted, 1 = maximum)
    
    // Set the default voice chat volume
    mp.voiceChat.defaultVolume = volume;

    // Notify the player that the voice chat volume has been set
    mp.gui.chat.push("Voice chat volume set to: " + volume);
}

// Bind the function to a key (the "E" key)
mp.keys.bind(69, false, function() { // 69 is the key code for "E"
    setVoiceChatVolume(); // Call the function to change the voice chat volume
});


See also

Template:VoiceChat functions c