Neffax Posted February 8, 2022 Share Posted February 8, 2022 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now