multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.38k stars 424 forks source link

playSound3D don't support setSoundPosition #650

Closed FileEX closed 5 years ago

FileEX commented 5 years ago

Describe the bug setSoundPosition don't work at sound which is created with playSound3D. Only don't work if path is URL.

To reproduce

local x,y,z = getElementPosition(localPlayer)
local snd = playSound3D('music.mp3',x,y,z,false,false)

addCommandHandler('ps',function(cmd,p)
    setSoundPosiiton(snd,p) -- will return true but don't change position
end)

Expected behaviour

Screenshots

Version 1.5.6

Additional context 3D sounds don't support setSoundPosition

CrosRoad95 commented 5 years ago

setSoundPosiiton i think you make typo in function name, should be setSoundPosition or, you pass string as position, and script could not be able to convert it to float

FileEX commented 5 years ago

Yes, it setSoundPosition, my mistake on github :P

FileEX commented 5 years ago

And the same code with playSound instead playSound3D will work.

ghost commented 5 years ago

Its working just fine - cant reproduce it. The only thing i've noticed: When passing an invalid position argument to it, it will start from 0 instead of returning false

local uSound = false

addEventHandler("onClientResourceStart", resourceRoot, function()
    uSound = playSound3D("music.mp3", 0, 0, 3.5, true)
end)

addCommandHandler("ssp", function(strCMD, position)
    outputChatBox("Seting sound position: " .. tostring(setSoundPosition(uSound, position)))
end)
FileEX commented 5 years ago

So playSound3D don't support setSoundPosition only if path is url instead file. I use release, and i was tested it on URL, i wasn't tested it on file path.

ghost commented 5 years ago

Oh, sorry - yeah - it`s obviously that you cant change the sound position of a stream because it would require MTA to cache the song locally. For streams, it should return false.

FileEX commented 5 years ago

But i can change the sound position of a stream, only in playSound :P So this don't work only on playSound3D

ghost commented 5 years ago

I've tested it with playSound and also with playSound3D - streamed songs (ex: podcasts) wont work for both.

FileEX commented 5 years ago

Convert music from yt and use download url as sound url. With playSound it work and can change position, but with 3D don't work.

Einheit-101 commented 5 years ago

What does setElementPosition() do with the streamed sound?

FileEX commented 5 years ago

I mean playback position instead position as sound element. With playSound it work, with playSound3D it don't work.

jushar commented 5 years ago

(Not) fixed in https://github.com/multitheftauto/mtasa-blue/commit/fa4cbe62511bcf2778699c152dbf43bce003f99f