Jump to content

Muting Voice Problem


Dealman

Recommended Posts

So a while ago I made this GUI for a team I'm part of, where as it utilizes a gridlist where you can mute/unmute and remotely set the channel of other players, however, while it was working fine on my local server when we tested it with 3-4 people it does not work on their server.

You can mute other players using the GUI, but they are automatically unmuted again after a few seconds and I can't for the love of god figure out why. And looking at the Voice Resource, I also managed to find this;

  
-- Functions for backward compatibility only 
-- DO NOT USE THESE AS THEY WILL BE REMOVED IN A LITTLE WHILE -- 
function isPlayerMuted ( player )           return isPlayerVoiceMuted ( player ) end 
function setPlayerMuted ( player, muted )   return setPlayerVoiceMuted ( player, muted ) end 
function getPlayerMutedByList ( player )    return getPlayerVoiceMutedByList ( player ) end 
-- DO NOT USE THESE AS THEY WILL BE REMOVED IN A LITTLE WHILE -- 
  

And this is the code I use for server-side muting;

  
function togglePlayerMute(playerRef, selectedChannel, localPlayerAccount) 
    local isMuted = exports.voice:isPlayerMuted(playerRef) 
    local sourceNameTag = getPlayerName(localPlayerAccount) 
    local nameTag = getPlayerNametagText(playerRef) 
    local selectedClient = getPlayerName(playerRef) 
    if(checkPermissions(localPlayerAccount,selectedChannel,true)) then 
        if(isMuted == true) then 
            outputChatBox("#FF88FFVoice: "..tostring(nameTag).."#FF88FF was unmuted by "..sourceNameTag, getRootElement(), 255, 0, 0, true) 
            local isNowMuted = exports.voice:setPlayerMuted(playerRef, false) 
            --triggerClientEvent("giveTTSMessage", playerRef, "You have been unmuted by "..sourceNameTag:gsub("#%x%x%x%x%x%x",""), "en", 1) 
        elseif(isMuted == false) then 
            outputChatBox("#FF88FFVoice: "..tostring(nameTag).."#FF88FF was muted by "..sourceNameTag, getRootElement(), 255, 0, 0, true) 
            local isNowMuted = exports.voice:setPlayerMuted(playerRef, true) 
            --triggerClientEvent("giveTTSMessage", playerRef, "You have been muted by "..sourceNameTag:gsub("#%x%x%x%x%x%x",""), "en", 1) 
        end 
        --local isNowMuted = exports.voice:setPlayerMuted(playerRef, not isMuted) 
    else 
        outputChatBox("#FF88FFVoice Error: You don't have permission to #FFBBFFtoggle mute#FF88FF.", client, 255, 0, 0, true) 
    end 
end 
addEvent("onTogglePlayerMute", true) 
addEventHandler("onTogglePlayerMute", getRootElement(), togglePlayerMute) 
  

Is it not working because I'm using what I assume are outdated functions? I don't know which functions else to use for this, looking at the Voice Resource, there's addPlayerMutedBy and setPlayerVoiceMuted. Is setPlayerVoiceMuted the function I should use? I assume addPlayerMutedBy is the client-side muting where as for example you use the scoreboard to mute a specific player?

Any help would be greatly appreciated!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...