Jump to content

Why it does not work?


Javier

Recommended Posts

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?

Link to comment

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 ) 

Link to comment
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.

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