MUMBLE VOIP - CONFIGURAÇÃO
How to configure your MUMBLE-VOIP
according to our product
To configure Mumble VoIP, locate the mumble-voip
file in the resources
folder on your server. When you access it, you will find a file called CLIENT.LUA
.
By default, the contents of this file will look like this:
-- Simulate PTT when radio is active
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if initialised then
local playerData = voiceData[playerServerId]
if not playerData then
playerData = {
mode = 2,
radio = 0,
radioActive = false,
call = 0,
callSpeaker = false,
speakerTargets = {},
}
end
if playerData.radioActive then -- Force PTT enabled
SetControlNormal(0, 249, 1.0)
SetControlNormal(1, 249, 1.0)
SetControlNormal(2, 249, 1.0)
end
if IsControlJustPressed(0, mumbleConfig.controls.proximity.key) then
local secondaryPressed = true
if mumbleConfig.controls.speaker.key ~= mumbleConfig.controls.proximity.key or mumbleConfig.controls.speaker.secondary == nil then
secondaryPressed = false
else
secondaryPressed = IsControlPressed(0, mumbleConfig.controls.speaker.secondary) and (playerData.call > 0)
end
if not secondaryPressed then
local voiceMode = playerData.mode
local newMode = voiceMode + 1
if newMode > #mumbleConfig.voiceModes then
voiceMode = 1
else
voiceMode = newMode
end
NetworkSetTalkerProximity(mumbleConfig.voiceModes[voiceMode][1] + 0.0)
SetVoiceData("mode", voiceMode)
playerData.mode = voiceMode
end
end
if mumbleConfig.radioEnabled then
if not mumbleConfig.controls.radio.pressed then
if IsControlJustPressed(0, mumbleConfig.controls.radio.key) then
if playerData.radio > 0 then
SetVoiceData("radioActive", true)
playerData.radioActive = true
SetPlayerTargets(callTargets, speakerTargets, vehicleTargets, radioTargets) -- Send voice to everyone in the radio and call
PlayMicClick(playerData.radio, true)
if mumbleConfig.showRadioList then
SendNUIMessage({ radioId = playerServerId, radioTalking = true }) -- Set client talking in radio list
end
mumbleConfig.controls.radio.pressed = true
Citizen.CreateThread(function()
while IsControlPressed(0, mumbleConfig.controls.radio.key) do
Citizen.Wait(0)
end
SetVoiceData("radioActive", false)
SetPlayerTargets(callTargets, speakerTargets, vehicleTargets) -- Stop sending voice to everyone in the radio
PlayMicClick(playerData.radio, false)
if mumbleConfig.showRadioList then
SendNUIMessage({ radioId = playerServerId, radioTalking = false }) -- Set client talking in radio list
end
playerData.radioActive = false
mumbleConfig.controls.radio.pressed = false
end)
end
end
end
else
if playerData.radioActive then
SetVoiceData("radioActive", false)
playerData.radioActive = false
end
end
if mumbleConfig.callSpeakerEnabled then
local secondaryPressed = false
if mumbleConfig.controls.speaker.secondary ~= nil then
secondaryPressed = IsControlPressed(0, mumbleConfig.controls.speaker.secondary)
else
secondaryPressed = true
end
if IsControlJustPressed(0, mumbleConfig.controls.speaker.key) and secondaryPressed then
if playerData.call > 0 then
SetVoiceData("callSpeaker", not playerData.callSpeaker)
playerData.callSpeaker = not playerData.callSpeaker
end
end
end
end
end
end)
Replace
with the code below:
-- Simulate PTT when radio is active
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if initialised then
local playerData = voiceData[playerServerId]
if not playerData then
playerData = {
mode = 2,
radio = 0,
radioActive = false,
call = 0,
callSpeaker = false,
speakerTargets = {},
}
end
if playerData.radioActive then -- Force PTT enabled
SetControlNormal(0, 249, 1.0)
SetControlNormal(1, 249, 1.0)
SetControlNormal(2, 249, 1.0)
end
if IsControlJustPressed(0, mumbleConfig.controls.proximity.key) then
local secondaryPressed = true
if mumbleConfig.controls.speaker.key ~= mumbleConfig.controls.proximity.key or mumbleConfig.controls.speaker.secondary == nil then
secondaryPressed = false
else
secondaryPressed = IsControlPressed(0, mumbleConfig.controls.speaker.secondary) and (playerData.call > 0)
end
if not secondaryPressed then
local voiceMode = playerData.mode
local newMode = voiceMode + 1
if newMode > #mumbleConfig.voiceModes then
voiceMode = 1
else
voiceMode = newMode
end
NetworkSetTalkerProximity(mumbleConfig.voiceModes[voiceMode][1] + 0.0)
TriggerEvent("hud_wanted:VoiceStatus", voiceMode)
SetVoiceData("mode", voiceMode)
playerData.mode = voiceMode
end
end
if mumbleConfig.radioEnabled then
if not mumbleConfig.controls.radio.pressed then
if IsControlJustPressed(0, mumbleConfig.controls.radio.key) then
if playerData.radio > 0 then
SetVoiceData("radioActive", true)
playerData.radioActive = true
SetPlayerTargets(callTargets, speakerTargets, vehicleTargets, radioTargets) -- Send voice to everyone in the radio and call
PlayMicClick(playerData.radio, true)
if mumbleConfig.showRadioList then
SendNUIMessage({ radioId = playerServerId, radioTalking = true }) -- Set client talking in radio list
end
mumbleConfig.controls.radio.pressed = true
TriggerEvent("hud_wanted:radioTalking", true)
Citizen.CreateThread(function()
while IsControlPressed(0, mumbleConfig.controls.radio.key) do
Citizen.Wait(0)
end
TriggerEvent("hud_wanted:radioTalking", false)
SetVoiceData("radioActive", false)
SetPlayerTargets(callTargets, speakerTargets, vehicleTargets) -- Stop sending voice to everyone in the radio
PlayMicClick(playerData.radio, false)
if mumbleConfig.showRadioList then
SendNUIMessage({ radioId = playerServerId, radioTalking = false }) -- Set client talking in radio list
end
playerData.radioActive = false
mumbleConfig.controls.radio.pressed = false
end)
end
end
end
else
if playerData.radioActive then
SetVoiceData("radioActive", false)
playerData.radioActive = false
end
end
if mumbleConfig.callSpeakerEnabled then
local secondaryPressed = false
if mumbleConfig.controls.speaker.secondary ~= nil then
secondaryPressed = IsControlPressed(0, mumbleConfig.controls.speaker.secondary)
else
secondaryPressed = true
end
if IsControlJustPressed(0, mumbleConfig.controls.speaker.key) and secondaryPressed then
if playerData.call > 0 then
SetVoiceData("callSpeaker", not playerData.callSpeaker)
playerData.callSpeaker = not playerData.callSpeaker
end
end
end
end
end
end)
Once this is done, we will now move on to the main voice configuration
Still in the same CLIENT.LUA
file Which by default will look like this:
-- UI
Citizen.CreateThread(function()
while true do
if initialised then
local playerId = PlayerId()
local playerData = voiceData[playerServerId]
local playerTalking = NetworkIsPlayerTalking(playerId)
local playerMode = 2
local playerRadio = 0
local playerRadioActive = false
local playerCall = 0
local playerCallSpeaker = false
if playerData ~= nil then
playerMode = playerData.mode or 2
playerRadio = playerData.radio or 0
playerRadioActive = playerData.radioActive or false
playerCall = playerData.call or 0
playerCallSpeaker = playerData.callSpeaker or false
end
-- Update UI
SendNUIMessage({
talking = playerTalking,
mode = mumbleConfig.voiceModes[playerMode][2],
radio = mumbleConfig.radioChannelNames[playerRadio] ~= nil and mumbleConfig.radioChannelNames[playerRadio] or playerRadio,
radioActive = playerRadioActive,
call = mumbleConfig.callChannelNames[playerCall] ~= nil and mumbleConfig.callChannelNames[playerCall] or playerCall,
speaker = playerCallSpeaker,
})
Citizen.Wait(200)
else
Citizen.Wait(0)
end
end
end)
Replace
with the code below:
-- UI
Citizen.CreateThread(function()
while true do
if initialised then
local playerId = PlayerId()
local playerData = voiceData[playerServerId]
local playerTalking = NetworkIsPlayerTalking(playerId)
local playerMode = 2
local playerRadio = 0
local playerRadioActive = false
local playerCall = 0
local playerCallSpeaker = false
if playerData ~= nil then
playerMode = playerData.mode or 2
playerRadio = playerData.radio or 0
playerRadioActive = playerData.radioActive or false
playerCall = playerData.call or 0
playerCallSpeaker = playerData.callSpeaker or false
end
-- Update UI
SendNUIMessage({
talking = playerTalking,
mode = mumbleConfig.voiceModes[playerMode][2],
radio = mumbleConfig.radioChannelNames[playerRadio] ~= nil and mumbleConfig.radioChannelNames[playerRadio] or playerRadio,
radioActive = playerRadioActive,
call = mumbleConfig.callChannelNames[playerCall] ~= nil and mumbleConfig.callChannelNames[playerCall] or playerCall,
speaker = playerCallSpeaker,
})
TriggerEvent("hud_wanted:userTalking", playerTalking)
Citizen.Wait(200)
else
Citizen.Wait(0)
end
end
end)
All ready, your mumble-voip
is configured! All Hud information is working!
Regarding other voice systems, open a ticket to ask questions about whether there is support or not!
Last updated