Slim. Posted December 6, 2011 Share Posted December 6, 2011 (edited) Well, I'm trying to make a script which plays a sound at the location specified.. but its not working. any errors? local soundsTable = { "sound.mp3" } function Music() local soundPath = soundsTable[math.random(#soundsTable)] sound = playSound3D("sound/"..tostring(soundPath), -89.272094726563, -48.133323669434, 720.40222167969, true) setSoundMaxDistance(sound,50) setSoundVolume (sound,0.7) outputChatBox(tostring(sound)) end setTimer(Music,50,1) and the meta.. Edited December 6, 2011 by Guest Link to comment
^Dev-PoinT^ Posted December 6, 2011 Share Posted December 6, 2011 Please Use [lua] Tags and see this https://wiki.multitheftauto.com/wiki/PlaySound3D Link to comment
Slim. Posted December 6, 2011 Author Share Posted December 6, 2011 Sorry for that, edited. And yeah, its not working.. already tried that. Link to comment
^Dev-PoinT^ Posted December 6, 2011 Share Posted December 6, 2011 there is no event on the script try this local soundsTable = { "sound.mp3" } function Music() local soundPath = soundsTable[math.random(#soundsTable)] sound = playSound3D("sound/"..tostring(soundPath), -89.272094726563, -48.133323669434, 720.40222167969, true) setSoundMaxDistance(sound,50) setSoundVolume (sound,0.7) outputChatBox(tostring(sound)) setTimer(Music,50,1) end addEventHandler( "onClientResourceStart", getRootElement( ), Music) Link to comment
Aibo Posted December 6, 2011 Share Posted December 6, 2011 ^Dev-PoinT^ you've just created an infinite loop for topic starter: please provide more info. how do you know it's not working. and use /debugscript 3 Link to comment
Slim. Posted December 6, 2011 Author Share Posted December 6, 2011 Sorry Sir, The debug gives me a message saying "Expected String at argument" and "Attempt to call a Userdate Value" Thanks in Advance. Link to comment
Aibo Posted December 6, 2011 Share Posted December 6, 2011 it is also supposed to show line numbers errors are at. i am assuming this is not the whole script, cant see an obvious "attempt to call a userdata value" oh and iirc if your mp3 is in a subfolder, you should specify it in meta.xml, right now you only have file name 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