myonlake Posted October 6, 2011 Share Posted October 6, 2011 (edited) Hello, As you know, using addCommandHandler with playSound3D works just fine, BUT the problem is that others cannot hear it, what should I do else on the below script to make it work for everybody, not just for myself. -- Funny song function playSong1() local song1 = playSound3D("sounds/cool.mp3", -1491, 763, 9, false) setSoundVolume(song1, 0.7) setSoundMaxDistance(song1, 100) end addCommandHandler("cool", playSong1) I have tried timers too but they didn't work either. Edited May 30, 2019 by myonlake Link to comment
Aibo Posted October 6, 2011 Share Posted October 6, 2011 you need the server to tell all the clients what to do. so the same code would be executed on all clients, not just one who typed the command. there is an event system for that. Link to comment
Sora Posted October 6, 2011 Share Posted October 6, 2011 (edited) hmmm try this function song1 ( player, command ) local sound = playSound("sounds/cool.mp3") -Play the sound setSoundVolume(sound, 1.0) -The Volume end addCommandHandler ( "song1", song1 ) Edited October 6, 2011 by Guest Link to comment
myonlake Posted October 6, 2011 Author Share Posted October 6, 2011 you need the server to tell all the clients what to do. so the same code would be executed on all clients, not just one who typed the command.there is an event system for that. Heh! Thank you! hmmm try this function song1 ( player, command ) local sound = playSound("sounds/cool.mp3") setSoundVolume(sound, 1.0) end addCommandHandler ( "song1", song1 ) That would not work... setSoundMaxDistance is the distance of the sound, it doesn't effect, because I can hear the sound normally, others don't. By the events I did it Link to comment
TAPL Posted October 6, 2011 Share Posted October 6, 2011 Server side addCommandHandler("cool", function () triggerClientEvent ( root, "StartSong", root ) end) Client Side function Sound () local song1 = playSound3D("sounds/cool.mp3", -1491, 763, 9, false) setSoundVolume(song1, 0.7) setSoundMaxDistance(song1, 100) end addEvent( "StartSong", true ) addEventHandler( "StartSong", getRootElement(), Sound ) Link to comment
myonlake Posted October 6, 2011 Author Share Posted October 6, 2011 Server side addCommandHandler("cool", function () triggerClientEvent ( root, "StartSong", root ) end) Client Side function Sound () local song1 = playSound3D("sounds/cool.mp3", -1491, 763, 9, false) setSoundVolume(song1, 0.7) setSoundMaxDistance(song1, 100) end addEvent( "StartSong", true ) addEventHandler( "StartSong", getRootElement(), Sound ) Problem was already solved if you didn't know 1 Link to comment
angeluni Posted June 4, 2018 Share Posted June 4, 2018 I am having the same problem as resolved? 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