VoiceChat.defaultVolume

From RAGE Multiplayer Wiki
Revision as of 20:47, 6 October 2024 by Caballero (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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