SthatycSoul. Posted February 3, 2016 Share Posted February 3, 2016 Hello guys, ¿Can you help me? I start to do a new server for MTA, and I want to add a song on all map. The server is like a rol gsme, and I want, when the players are in the map, they listen the background music, like a rol game... How I do that? I actually search how do it this, but nothing works... What I need to put in the "Meta.xml" and the "Lua" file? This is for the 1.5.2 VERSION. Thank you for read. Link to comment
KariiiM Posted February 3, 2016 Share Posted February 3, 2016 Use this function: playSound Link to comment
knightscript Posted February 7, 2016 Share Posted February 7, 2016 Indeed that is the function, here is a small example that will start playing "mymusic.mp3" when the player connects: function onplayerjoin (source) local sound = playSound("mymusic.mp3") setSoundVolume(sound, 0.3) -- set the sound volume to 30%, it can be less if its a background music end addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), onplayerjoin) --add the event handler and of course you will want to add this to your meta file: <file src="mymusic.mp3" /> Link to comment
SthatycSoul. Posted March 16, 2016 Author Share Posted March 16, 2016 Indeed that is the function, here is a small example that will start playing "mymusic.mp3" when the player connects: function onplayerjoin (source) local sound = playSound("mymusic.mp3") setSoundVolume(sound, 0.3) -- set the sound volume to 30%, it can be less if its a background music end addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), onplayerjoin) --add the event handler and of course you will want to add this to your meta file: <file src="mymusic.mp3" /> Thank you guys. 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