Javier Posted June 6, 2013 Posted June 6, 2013 Hello. I've a problem with this script. function soundWeather () local weather = getWeather() if weather == 8 then local sound = playSound("Sound/rain.mp3", true) setSoundVolume(sound, 0.7) setWorldSoundEnabled( 4, false ) end end addEventHandler( "onResourceStart", resourceRoot, soundWeather ) The problem is that: No sound plays and does not remove the sound of thunder. I've updated the goal and everything else. Any help?
TAPL Posted June 6, 2013 Posted June 6, 2013 The event is server-side only, and the function are client-side. Use the event: onClientResourceStart
Javier Posted June 6, 2013 Author Posted June 6, 2013 okay, Now it Works But when is the weather is other , the sound reproducing continuous... function soundWeather () local weather = getWeather() if weather == 8 then local sound = playSound("Sound/rain.mp3", true) setSoundVolume(sound, 100) setWorldSoundEnabled( 4, false ) else stopSound(sound) end end addEventHandler( "onClientResourceStart", resourceRoot, soundWeather )
TAPL Posted June 6, 2013 Posted June 6, 2013 okay, Now it Works But when is the weather is other , the sound reproducing continuous... function soundWeather () local weather = getWeather() if weather == 8 then local sound = playSound("Sound/rain.mp3", true) setSoundVolume(sound, 100) setWorldSoundEnabled( 4, false ) else stopSound(sound) end end addEventHandler( "onClientResourceStart", resourceRoot, soundWeather ) There no event for the weather when it change, so you will have to play around it, you can use timer for this task.
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