myonlake Posted October 6, 2011 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
Aibo Posted October 6, 2011 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.
Sora Posted October 6, 2011 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
myonlake Posted October 6, 2011 Author 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
TAPL Posted October 6, 2011 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 )
myonlake Posted October 6, 2011 Author 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
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