Jump to content

voice problem


Neffax

Recommended Posts

 
 
I have problm with voice script, the icon voice doesn't visible to localplayer, and i need how to make it when a player is talking that only the closest players can hear it
 
 
 
 
 
 
SETTINGS_REFRESH = 2000 -- Interval in which team channels are refreshed, in MS.
bShowChatIcons = true
 
voicePlayers = {}
globalMuted = {}
local range = 5
 
---
addEventHandler ( "onClientPlayerVoiceStart", root,
if (source and isElement(source) and getElementType(source) == "player") and localPlayer ~= source then
 
    local sX, sY, sZ = getElementPosition(localPlayer)
 
    local rX, rY, rZ = getElementPosition(source)
 
    local distance = getDistanceBetweenPoints3D(sX, sY, sZ, rX, rY, rZ)
 
    if distance <= range then
 
        voicePlayers[source] = true
 
    else
 
        cancelEvent()--This was the :~
 
    end
 
end
 
end
)
 
addEventHandler ( "onClientPlayerVoiceStop", root,
    function()
        voicePlayers[source] = nil
    end
)
 
addEventHandler ( "onClientPlayerQuit", root,
    function()
        voicePlayers[source] = nil
    end
)
---
 
function checkValidPlayer ( player )
    if not isElement(player) or getElementType(player) ~= "player" then
        outputDebugString ( "is/setPlayerVoiceMuted: Bad 'player' argument", 2 )
        return false
    end
    return true
end
 
---
 
setTimer (
    function()
        bShowChatIcons = getElementData ( resourceRoot, "show_chat_icon", show_chat_icon )
    end,
SETTINGS_REFRESH, 0 )
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...