Jump to content

play3d


Recommended Posts

Hi forum.

Well iwas trying to make a panel gui with sounds.

But i want a play3d sound

I have this. If someone can helpme and explain why dont work

i think my bad is in getElementPosition

  
addEvent("returnSound",true) 
addEventHandler("returnSound",getRootElement(), 
function (sound) 
local px, py, pz = getElementPosition ( localPlayer ) 
radio = playSound3D("files/".. tostring(sound), px, py, pz, false) 
setSoundMaxDistance( radio,20 ) 
end) 

clientside

Link to comment

Client

  
addEvent( 'returnSound',true ) 
addEventHandler( 'returnSound', root, 
    function ( sound ) 
        local px, py, pz = getElementPosition ( source ) 
        radio = playSound3D( 'files/'.. tostring( sound ), px, py, pz, false ) 
        setSoundMaxDistance( radio,20 ) 
    end 
) 
  

Server

addEvent( 'sendSound',true ) 
addEventHandler( 'sendSound', root, 
    function ( sound ) 
        triggerClientEvent( "returnSound", source, sound ) 
    end 
) 

Because you trigger root with source.Source is root ( all elements in your situation ), but function getElementPosition return only for one element position.

Also you not say, what is source in event sendSound.( player, ped, or something )

Tabulate your code in next time.

viewtopic.php?f=91&t=40807

P.S Also show, how you trigger event sendSound.

Link to comment

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