VoiceChat.defaultVolume
Client-Side Function
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
});