Blaawee Posted November 29, 2011 Posted November 29, 2011 (edited) EDIT Edited December 6, 2011 by Guest
Castillo Posted November 29, 2011 Posted November 29, 2011 What do you mean by "random sound"? do you mean a random sound file?
Blaawee Posted November 29, 2011 Author Posted November 29, 2011 (edited) EDIT Edited December 6, 2011 by Guest
Castillo Posted November 29, 2011 Posted November 29, 2011 local soundsTable = { [1]="sound1.mp3", [2]="sound2.mp3", } function Music() local soundPath = soundsTable[math.random(#soundsTable)] sound = playSound3D("sound/"..tostring(soundPath), 568.89764, -1857.21130, 4.7015, true) setSoundMaxDistance(sound, 30) end addEventHandler("onClientResourceStart", resourceRoot, Music)
12p Posted November 29, 2011 Posted November 29, 2011 but not playing a random SO? IT ALWAYS REPEAT THE SAME SOUND OR WHAT?
Blaawee Posted November 29, 2011 Author Posted November 29, 2011 but not playing a random SO? IT ALWAYS REPEAT THE SAME SOUND OR WHAT? yes it is
Castillo Posted November 29, 2011 Posted November 29, 2011 local soundsTable = { "sound1.mp3", "sound2.mp3", } function Music() local soundPath = soundsTable[math.random(#soundsTable)] sound = playSound3D("sound/"..tostring(soundPath), 568.89764, -1857.21130, 4.7015, true) setSoundMaxDistance(sound, 30) end addEventHandler("onClientResourceStart", resourceRoot, Music) Try that, I don't know if it'll make any difference.
myonlake Posted November 30, 2011 Posted November 30, 2011 Tripleposting is not allowed, nor is doubleposting. It is pretty unlikely that it will play the second sound as you only have two sounds. It will mostly just be the other one, hardly the second one. So, I suggest more sounds. That script that Castillo made, should be working in my opinion. What I understood was that the script was working but it only plays the other sound. If it's not working at all, check your meta.xml, debugscript, folders.
Blaawee Posted November 30, 2011 Author Posted November 30, 2011 (edited) EDIT Edited December 6, 2011 by Guest
12p Posted November 30, 2011 Posted November 30, 2011 Then do local soundsTable = { "sound1.mp3", "sound2.mp3", "sound3.mp3", "sound4.mp3", "sound5.mp3", }
myonlake Posted December 1, 2011 Posted December 1, 2011 About tripleposting/doubleposting: Ever heard of deleting old messages, and then posting a new one.
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