ice_brasil Posted May 7, 2013 Share Posted May 7, 2013 I used this function to when I activate the command on a sound server starts,But when I'm using only I listen I want all players server hear the sound What do I add to when I use the command every listen online? function cevent (thePlayer) local sound = playSound("evcriado.mp3") setSoundVolume(sound, 0.5) end addCommandHandler("cevent",cevent) Sorry my bad english I'm brasilian HELP-ME Link to comment
Castillo Posted May 7, 2013 Share Posted May 7, 2013 You must trigger a server side event, then from the server side, trigger a client side event to play the sound. Link to comment
Sasu Posted May 7, 2013 Share Posted May 7, 2013 (edited) --Client function cevent () if isElement(sound) then stopSound(sound) end sound = playSound("evcriado.mp3") setSoundVolume(sound, 0.5) end addEvent("onPlayerRequestSound", true) addEventHandler("onPlayerRequestSound", root, cevent) --Server function requestSound() triggerClientEvent("onPlayerRequestSound", root) end addCommandHandler("cevent", requestSound) Edited May 7, 2013 by Guest Link to comment
xXMADEXx Posted May 7, 2013 Share Posted May 7, 2013 Make sure to check, if the sound is there, and if it is, then destroy it, other wise you would be able to play the same song like 5 times @ the same time.. 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