Hi all,
Just wondering if anyone has examples of how to use the Mumble natives bundled in with FiveM these days.
Seeking a basic script or two before looking further into it all.
And by that I mean going down the rabbit hole once again.
Many thanks.
DK
1 Like
If an element manages to stumble across this, Ideally I’d just like to know the following.
With the 5 natives, All client sided as per the native reference guide;
Differences between the Channel and targetIDs?
Only 1 to 30 TargetIDs can exist.
But infinite channels within ID’s?
Can a TargetID have Multiple Channels without cross over? Eg TID:1 Channel Alpha not hear TID:1 Channel Bravo?
I guess ideally if we could get a mad breakdown of how to get the most out of it, I would love you forever.
1 Like
If anyone has any useful examples of implimenting these natives, I’d appreciate if you could share or elaborate on them.
Ideally moving away from third party programs would be great (ie Kill off: ■■■■■■■■/RTCServers for phones).
1 Like
God bless the discord search function.
1 Like
Snippet from Ferrum.
Split the map into a grid.
People can talk across multiple zones.
Just needs a limiter on distance.
In no way am I providing it here other than as a direct pull from discord to assist people in searching for an example.
local deltas = {
vector2(-1, -1),
vector2(-1, 0),
vector2(-1, 1),
vector2(0, -1),
vector2(1, -1),
vector2(1, 0),
vector2(1, 1),
vector2(0, 1),
}
local function getGridChunk(x)
return math.floor((x + 8192) / 128)
end
local function getGridBase(x)
return (x * 128) - 8192
end
local function toChannel(v)
return (v.x << 8) | v.y
end
local targetList = {}
local lastTargetList = {}
-- loop
local coords = GetEntityCoords(PlayerPedId())
local gz = vector2(getGridChunk(coords.x), getGridChunk(coords.y))
local gridZone = toChannel(gz)
NetworkSetVoiceChannel(gridZone)
targetList = {}
for _, d in ipairs(deltas) do
local v = coords.xy + (d * 20) -- edge size
targetList[toChannel(vector2(getGridChunk(v.x), getGridChunk(v.y)))] = true
end
-- super naive hash difference
local different = false
for k, _ in pairs(targetList) do
if not lastTargetList[k] then
different = true
break
end
end
if not different then
for k, _ in pairs(lastTargetList) do
if not targetList[k] then
different = true
break
end
end
end
if different then
-- you might want to swap between two targets when changing
MumbleClearVoiceTarget(2)
for k, _ in pairs(targetList) do
MumbleAddVoiceTargetChannel(2, k)
end
MumbleSetVoiceTarget(2)
lastTargetList = targetList
end
2 Likes
This is good, but it leaves oh so much unanswered?
Is the grid of a map? What is the grid? The purpose of a grid?
What’s the purpose of adding / subtracting 8192 and dividing / multiplying 128
Is The native:
NetworkSetVoiceChannel
A mumble-related channel?
Are the grids pre-defined, or can you create custom zones?
Did you find any other resources?
This is awesome, and I find myself in the exact same boat as you two years later, but am still lost as ever