BorderLine Posted March 7, 2012 Share Posted March 7, 2012 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
BorderLine Posted March 7, 2012 Author Share Posted March 7, 2012 addEvent("sendSound",true) addEventHandler("sendSound",getRootElement(), function (sound) triggerClientEvent("returnSound",getRootElement(),sound) end) Link to comment
Kenix Posted March 7, 2012 Share Posted March 7, 2012 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
BorderLine Posted March 7, 2012 Author Share Posted March 7, 2012 Working.. thx for your time 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