Tycka Posted December 13, 2014 Share Posted December 13, 2014 This code must voice chat do local but its didn't work voice chat still global local nearbyPlayers = {} addEventHandler( 'onPlayerVoiceStart', root, function() local chatRadius = 10 local posX, posY, posZ = getElementPosition( source ) local chatSphere = createColSphere( posX, posY, posZ, chatRadius ) nearbyPlayers = getElementsWithinColShape( chatSphere, "player" ) destroyElement( chatSphere ) local empty = exports.voice:getNextEmptyChannel ( ) exports.voice:setPlayerChannel(source, empty) for index, player in ipairs (nearbyPlayers) do exports.voice:setPlayerChannel(player, empty) end end) addEventHandler("onPlayerVoiceStop",root, function() exports.voice:setPlayerChannel(source) for index, player in ipairs (nearbyPlayers) do exports.voice:setPlayerChannel(player) end nearbyPlayers = {} end) Link to comment
Bonsai Posted December 13, 2014 Share Posted December 13, 2014 First of all, there is a function to get the distance between points. So you don't need to create a colshape all the time. Link to comment
Tycka Posted December 13, 2014 Author Share Posted December 13, 2014 How should it look like? 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