Wes Posted March 13, 2013 Share Posted March 13, 2013 Hey! I want some ambient sound on my zombie server. I made the sound cutting, so every ambient is in other .mp4 file Here is the code. local sounds = {" sounds/ambient0.mp4, sounds/ambient1.mp4, sounds/ambient2.mp4, sounds/ambient3.mp4, sounds/ambient4.mp4, sounds/ambient5.mp4, sounds/ambient6.mp4, sounds/ambient7.mp4, sounds/ambient8.mp4, sounds/ambient9.mp4, sounds/ambient10.mp4, sounds/ambient11.mp4, sounds/ambient12.mp4, sounds/ambient13.mp4, sounds/ambient14.mp4, sounds/ambient15.mp4, sounds/ambient16.mp4, sounds/ambient17.mp4, sounds/ambient18.mp4, sounds/ambient19.mp4, sounds/ambient20.mp4, sounds/ambient21.mp4, sounds/ambient22.mp4, sounds/ambient23.mp4, sounds/ambient24.mp4, sounds/ambient25.mp4, sounds/ambient26.mp4, sounds/ambient27.mp4, sounds/ambient28.mp4, sounds/ambient29.mp4, sounds/ambient30.mp4, sounds/ambient31.mp4, sounds/ambient32.mp4, sounds/ambient33.mp4, sounds/ambient34.mp4 "} function playsound() playSound(sounds[math.random(1, #sounds)]) setSoundVolume(sound, 300.0) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),playsound) setTimer(playsound, 60000,0) Here is the XML: <meta> <info author="Yakuza" type="script" description="Ambient Sounds" version="1.0.1"/> <script src="ambience.lua" type="client" /> <file src="sounds/ambient0.mp4" /> <file src="sounds/ambient1.mp4" /> <file src="sounds/ambient2.mp4" /> <file src="sounds/ambient3.mp4" /> <file src="sounds/ambient4.mp4" /> <file src="sounds/ambient5.mp4" /> <file src="sounds/ambient6.mp4" /> <file src="sounds/ambient7.mp4" /> <file src="sounds/ambient8.mp4" /> <file src="sounds/ambient9.mp4" /> <file src="sounds/ambient10.mp4" /> <file src="sounds/ambient11.mp4" /> <file src="sounds/ambient12.mp4" /> <file src="sounds/ambient13.mp4" /> <file src="sounds/ambient14.mp4" /> <file src="sounds/ambient15.mp4" /> <file src="sounds/ambient16.mp4" /> <file src="sounds/ambient17.mp4" /> <file src="sounds/ambient18.mp4" /> <file src="sounds/ambient19.mp4" /> <file src="sounds/ambient20.mp4" /> <file src="sounds/ambient21.mp4" /> <file src="sounds/ambient22.mp4" /> <file src="sounds/ambient23.mp4" /> <file src="sounds/ambient24.mp4" /> <file src="sounds/ambient25.mp4" /> <file src="sounds/ambient26.mp4" /> <file src="sounds/ambient27.mp4" /> <file src="sounds/ambient28.mp4" /> <file src="sounds/ambient29.mp4" /> <file src="sounds/ambient30.mp4" /> <file src="sounds/ambient31.mp4" /> <file src="sounds/ambient32.mp4" /> <file src="sounds/ambient33.mp4" /> <file src="sounds/ambient34.mp4" /> </meta> And here is the error message I get when I start the resource: BASS ERROR 2 in LoadMedia path:C:\Program Files (x86)\MTA San Andreas 1.3\mods\deathmatch\resources\ambient\ sounds\ambient0.mp4, sounds\ambient1.mp4, sounds\ambient2.mp4, sounds\ambient3.mp4, sounds\ambient4.mp4, sounds\ambient5.mp4, sounds\ambient6.mp4, sounds\ambient7.mp4, sounds\ambient8.mp4, sounds\ambient9.mp4, sounds\ambient10.mp4, sounds\ambient11.mp4, sounds\ambient12.mp4, sounds\ambient13.mp4, sounds\ambient14.mp4, sounds\ambient15.mp4, sounds\ambient16.mp4, sounds\ambient17.mp4, sounds\ambient18.mp4, sounds\ambient19.mp4, sounds\ambient20.mp4, sounds\ambient21.mp4, sounds\ambient22.mp4, sounds\ambient23.mp4, sounds\ambient24.mp4, sounds\ambient25.mp4, sounds\ambient26.mp4, sounds\ambient27.mp4, sounds\ambient28.mp4, sounds\ambient29.mp4, sounds\ambient30.mp4, sounds\ambient31.mp4, sounds\ambient32.mp4, sounds\ambient33.mp4, sounds\ambient34.mp4 3d:0 loop:0 Link to comment
Anderl Posted March 13, 2013 Share Posted March 13, 2013 MP4 files aren't supported by playSound. Link to comment
Wes Posted March 13, 2013 Author Share Posted March 13, 2013 then what format should I convert it to? .waw or what? Link to comment
Anderl Posted March 13, 2013 Share Posted March 13, 2013 In the playSound wiki page you have all supported file formats: MP3, WAV, OGG, RIFF, MOD, XM, IT, S3M. Link to comment
Wes Posted March 13, 2013 Author Share Posted March 13, 2013 I've converted it to .wav from mp4, it still doesn't work... Link to comment
Anderl Posted March 13, 2013 Share Posted March 13, 2013 Because your array is wrong. You added a single string to the first field of the array with all names of the files separated by commas. The array must be this way: local sounds = { "sounds/ambient0.wav", "sounds/ambient1.wav", "sounds/ambient3.wav", --[[ ADD OTHER FILES HERE ]] } 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