Jump to content

How to add a song in MTA map.


SthatycSoul.

Recommended Posts

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

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
  • 1 month later...
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

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