Advertisement
No4NaMe

WeatherSound

Mar 15th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. local weathersounds = {
  2. "thunder.mp3",
  3. "crow.mp3",
  4. }
  5. function PlayWeatherAmbience()
  6. local weatherID = getWeather()
  7. if weatherID == 8 or weatherID == 9 or weatherID == 16 or weatherID == 20 or weatherID == 118 then
  8. WeatherSound = playSound(weathersounds[math.random(1,#weathersounds)])
  9. setSoundVolume(WeatherSound,0.5)
  10. end
  11. end
  12. setTimer(PlayWeatherAmbience,60000,0)
  13. addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),PlayWeatherAmbience)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement