Blaawee Posted November 29, 2011 Share Posted November 29, 2011 (edited) EDIT Edited December 6, 2011 by Guest Link to comment
Castillo Posted November 29, 2011 Share Posted November 29, 2011 What do you mean by "random sound"? do you mean a random sound file? Link to comment
Blaawee Posted November 29, 2011 Author Share Posted November 29, 2011 (edited) EDIT Edited December 6, 2011 by Guest Link to comment
Castillo Posted November 29, 2011 Share 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) Link to comment
Blaawee Posted November 29, 2011 Author Share Posted November 29, 2011 it's work but not playing a random Link to comment
12p Posted November 29, 2011 Share Posted November 29, 2011 What is it doing instead of random? Link to comment
12p Posted November 29, 2011 Share Posted November 29, 2011 but not playing a random SO? IT ALWAYS REPEAT THE SAME SOUND OR WHAT? Link to comment
Blaawee Posted November 29, 2011 Author Share Posted November 29, 2011 but not playing a random SO? IT ALWAYS REPEAT THE SAME SOUND OR WHAT? yes it is Link to comment
Castillo Posted November 29, 2011 Share 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. Link to comment
Blaawee Posted November 30, 2011 Author Share Posted November 30, 2011 come on guys i realy need it Link to comment
myonlake Posted November 30, 2011 Share 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. Link to comment
Blaawee Posted November 30, 2011 Author Share Posted November 30, 2011 (edited) EDIT Edited December 6, 2011 by Guest Link to comment
12p Posted November 30, 2011 Share Posted November 30, 2011 Then do local soundsTable = { "sound1.mp3", "sound2.mp3", "sound3.mp3", "sound4.mp3", "sound5.mp3", } Link to comment
Blaawee Posted November 30, 2011 Author Share Posted November 30, 2011 i post the hole code Link to comment
myonlake Posted December 1, 2011 Share Posted December 1, 2011 About tripleposting/doubleposting: Ever heard of deleting old messages, and then posting a new one. 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