Ab-47 Posted January 25, 2013 Share Posted January 25, 2013 Hello guys, today I'll be showing you how to create your very own music script. Well first of all, we'd need a link to a working .mp3 sound, or any song from your personal files. We'll then need to open Notepad++ and begin with our work. Step 1; Open Notepad++ and set out 2 new pages, 1 for the meta.xml & 2nd for the client functions Step 2; Find a link or a sound file in your personal directory. Link should be in an .mp3 page else it'd not work. I chose the radio station power 181.fm; http://www.181.fm/winamp.pls?station=18 ... 0(Top%2040)&file=181-power.pls Step 3; Create a function and add valid arguments, in this case we use "local sound = playSound3D", where sound is the name we're defining the function. And of-course, 'playSound3D', is the function. Then we add arguments within the function itself. addEventHandler( 'onClientResourceStart', resourceRoot, function( ) local sound = playSound3D( 'Your Link here', x, y, z ) end ) Say for example your would like to set this sound in an interior or dimension, we could use; setElementInterior setElementDimension for example; setElementInterior ( sound, 17 ) and setElementDimension ( sound, 200 ) also if you'd want to add a sound from your personal folders, use; local sound = playSound("sound.mp3",false) and include this in your meta; "sound.mp3" /> Step 4; Now lets be more specific, lets add the maximum distance for the sound to reach, using; setSoundMaxDistance for example; setSoundMaxDistance ( sound, 400 ) Step 5; So we're finally done with the client sided, you don't neccesarrily need the server sided. Lets get an overview example of this script, shall we.. addEventHandler( 'onClientResourceStart', resourceRoot, function( ) local sound = playSound3D( 'http://www.181.fm/winamp.pls?station=181-power&style=mp3&description=Power%20181%20(Top%2040)&file=181-power.pls', 485.87612915039, -11.931990623474, 1000.679687 ) setSoundMaxDistance(sound, 600 ) setElementInterior ( sound, 17 ) end ) Which creates a sound, using a defined URL, in interior 17 with the maximum distance as 600 at the x, y, z position. You can also change the event handler to a command handler to start the sound whenever you like and if you'd like to stop the music, simple create a new function defining the valid arguments and add this; stopSound Thanks for reading. P.s; I think you'll know how to construct your meta.xml, if you're using custom sounds from your personal files, be sure to add this to your meta.xml; "sound.mp3" /> Link to comment
Anderl Posted January 25, 2013 Share Posted January 25, 2013 This is too easy, in my opinion it wasn't needed. It was well explained, though. Link to comment
Ab-47 Posted January 26, 2013 Author Share Posted January 26, 2013 This is too easy, in my opinion it wasn't needed. It was well explained, though. Aha, many people don't really know how to script. So I made this just for the newbies. Well stay tuned I'll introduce more upcoming tutorials much more harder than this. Thanks for the positive feedback though Link to comment
BlueBerry Posted February 8, 2013 Share Posted February 8, 2013 I usually stream stuff from my webhost. So you dont have the download the song. Link to comment
Ab-47 Posted February 8, 2013 Author Share Posted February 8, 2013 I usually stream stuff from my webhost. So you dont have the download the song. Exactly; local sound = playSound3D( 'Your Link here', x, y, z ) "Your Link here" defines the area where you paste a .mp3 link, no need to download the song. Link to comment
Max+ Posted February 9, 2013 Share Posted February 9, 2013 Goood [TUT] Thank's AB-47 ~ Link to comment
Recommended Posts