Klesh Posted November 6, 2011 Share Posted November 6, 2011 Hi community, i try to make a simple script, this script play's a sound with a command, the song play's for all! The code doesn't works. local root = getRootElement () function playXSSoundForPlayer(forAll) if (forAll) then playSound("/music/XS.mp3",false) else if (source == localPlayer) then playSound("/music/XS.mp3",false) else local x,y,z = getElementPosition(source) local sound = playSound3D("/music/XS.mp3",x,y,z,false) setSoundMinDistance(sound,5) setSoundMaxDistance(sound,40) attachElements(sound,source) end end end addEvent("onPlayerPlayXSSound", true) addEventHandler("onPlayerPlayXSSound", root, playXSSoundForPlayer) addCommandHandler( "playsound", playXSSoundForPlayer ) Link to comment
FatalTerror Posted November 6, 2011 Share Posted November 6, 2011 Try to use global value not local... sound = playSound("/music/XS.mp3", false) Link to comment
myonlake Posted November 6, 2011 Share Posted November 6, 2011 Did you add the file at meta.xml Link to comment
TAPL Posted November 6, 2011 Share Posted November 6, 2011 where the server side? also this is wrong playSound("/music/XS.mp3",false) it's should be playSound("music/XS.mp3",false) 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