Jump to content

[Bug] getSoundLength


InDev

Recommended Posts

Posted

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...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...