Jump to content

setSoundMaxDistance Problem


Tony Brand

Recommended Posts

Hi, i made a function called syncSong

it works like this:

 

addEvent("syncSong", true)
addEventHandler("syncSong", root,
	function( )
		local song = playSound("data/sound.mp3", false)
		setSoundVolume(song, 0.9)
		setSoundMaxDistance(song, 2)
	end)

as you see i setSoundMaxDistance(song, 2) so now sound must be played in a short range!but problem is when players use that command thats trigger this event,sound plays for whole server in every place!
also here is the CommandHandler
 

addCommandHandler( "alarm",
	triggerClientEvent("syncSong", getRootElement())
	etc(another codes under this line...)


 

Link to comment
5 minutes ago, Dimos7 said:

addEvent("syncSong", true)
addEventHandler("syncSong", root,
	function( )
		local x,y,z = getElementPosition(localPlayer)
		local song = playSound3D("data/sound.mp3", x, y, z, false)
		setSoundVolume(song, 0.9)
		setSoundMaxDistance( song, 100 )
	end)

 

it has no error but again whole the server can hear the sound :(

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...