InDev Posted August 16, 2011 Posted August 16, 2011 Hi all, I'm having a problem with the function getSoundLength in my script, it always return 100 for whatever sound I use and i can't get over this problem in my script, I'm under the last nightly MTA1.1 and I didn't have this problem before Here's the part of script that I use function play3DMusic(sonname, x, y, z, volume, attachedTo) local sound = playSound3D("sounds/"..sonname, x, y, z) setSoundVolume(sound, volume) if( attachedTo )then attachSound( sound, attachedTo ) end outputChatBox( "playing" ) end addEventHandler("play3DMusic", getLocalPlayer(), play3DMusic) function attachSound( sound, element ) if( sound and element )then outputChatBox( getSoundLength(sound) ) sTimer = setTimer( setSoundPos, 50, getSoundLength(sound)/50, sound, element ) outputChatBox( "attached" ) end end function setSoundPos( sound, element ) if( sound and element )then local x, y, z = getElementPosition( element ) setElementPosition( sound, x, y, z ) outputChatBox( "updated" ) else outputChatBox( "fail" ) end end I really need this function to know how many times the update timer must executes himself... Welcome to the beginning...
SHC//Sniper Posted August 18, 2011 Posted August 18, 2011 Mhmmmm could be a MTA bug. Report it to: http://bugs.mtasa.com You can do it a much easier way. Use attachElements (wiki says it does not support sounds but on my server it works.) New and active mtasa.com username: -ffs-Sniper!
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