When people are joining our server, sadly, they get “voice-spammed” as the range is global by default.
We need at float value, and by default it is int 0
I’ve tried using this, but the case is that voice receiving is in active state before this is run, so it results in about 5 seconds where you can hear everyone on the server. Imagine that with 64 players, and server
-- fix for OneSync global voice -- attempt 3 -- not working
AddEventHandler('onClientResourceStart', function(name)
if name == GetCurrentResourceName() then
NetworkSetTalkerProximity(7.0)
end
end)
Right now I’m using a rather wacko solution, to make sure it’s actually get’s changed as it doesn’t with the one above.
-- fix for OneSync global voice -- attempt #1
local oneSyncCount = 0
Citizen.CreateThread(function()
while true do
--print("NetworkGetTalkerProximity: "..NetworkGetTalkerProximity())
-- we're checking if we have a bad value, or if its not set at all (0 = not a float) - we need a float value
if NetworkGetTalkerProximity() > 1000000000 or NetworkGetTalkerProximity() < 1.0 or NetworkGetTalkerProximity() == 0 then
--print("Voice radius was: "..NetworkGetTalkerProximity().." - we're setting it ...")
NetworkSetTalkerProximity(7.0)
--print("talk proximity: "..NetworkGetTalkerProximity() .. " -- count: "..oneSyncCount)
oneSyncCount = oneSyncCount + 1
if oneSyncCount > 100 then
print("## Gee OneSync Voice work-around succeded ##")
return
end
end
Wait(5)
end
end)
Again, wacko. But what should work doesn’t seem to work like intended