bartje01 Posted March 4, 2011 Posted March 4, 2011 Hey guys. I have a race server. But how can I at music to a map? I readed the wiki and I saw sound effects. Didn't help me any further. Thanks it advance
proracer Posted March 4, 2011 Posted March 4, 2011 addEventHandler ( "onClientResourceStart", resourceRoot, function ( ) playSound ( 'mysong.mp3' ) -- put the song in your map folder end )
bartje01 Posted March 4, 2011 Author Posted March 4, 2011 Ok thanks. But now I have a folder in my recourses called: 'race-turbo' In the folder are 2 programs: Meta and Turbo.map Do I need to make a client.txt or smthing?
12p Posted March 5, 2011 Posted March 5, 2011 https://wiki.multitheftauto.com/wiki/Scripting_Introduction
bartje01 Posted March 5, 2011 Author Posted March 5, 2011 @ the kid. Can you even read? I told you guys that I've read the wiki but still didn't come out Where do I have to paste the code? In my Meta file? Or make a new file ?
CowTurbo Posted March 5, 2011 Posted March 5, 2011 Meta.xml is only for makeing resource know which scripts are u using at this folder. So, make a new file. Lets make it as example mysound.lua now open mysound.lua and copy paste this to there: addEventHandler ( "onClientResourceStart",getResourceRootElement(getThisResource()), function ( ) playSound ( 'mysong.mp3' ) -- put the song in your map folder end ) First, replace 'mysong' to your song name. ( Do not delete .mp3 ) Now open the meta.xml add those lines to there: ( Replace mysong to your song name ) save files, and restart script, should work. If u maked everything right
12p Posted March 5, 2011 Posted March 5, 2011 @ the kid.Can you even read? I told you guys that I've read the wiki but still didn't come out So when someone tells you THE RIGHT WIKI PAGE, WHERE EVERYTHING is there, you just "insult" and don't try to understand anything? You didn't read the wiki, you just SAW it. You should try to understand before asking for help... Whatever, CowTurbo gave you the code so I can't give you the lesson I've wanted to.
bartje01 Posted March 5, 2011 Author Posted March 5, 2011 Thankyou CowTurbo It works perfect. Can I also make it replay after it's done?
Castillo Posted March 5, 2011 Posted March 5, 2011 I would say, "get lost" but this is something easy so i will tell you. addEventHandler ( "onClientResourceStart",getResourceRootElement(getThisResource()), function ( ) playSound ( 'mysong.mp3' , true) end )
bartje01 Posted March 5, 2011 Author Posted March 5, 2011 @ Thekid Well I didn't really insult you. I asked if you can read. Not said that you can't read. I just think it's to easy to say to just send me the wiki link. It's just so you can get a post in my eyes I know the wiki link btw. Otherwise I couldn't have read it already. And yes, I did read it. I just didn't find it. @Solidsnake. Thanks. But why get lost? : o
12p Posted March 5, 2011 Posted March 5, 2011 To say "can you even read?" is an INDIRECT insult. Don't try to lie. You wanted to say I'm a stupid guy that doesn't help. I don't care, anyway. You are the one that won't learn anything... And if you readed the wiki page I gave you, and didn't find the solution, means you did read but without paying attention to...
bartje01 Posted March 5, 2011 Author Posted March 5, 2011 Alright, my apologise. But I didn't mean that you're a stupid guy though. Well. I've really read the basics. I did it more times. Because a little while ago I was a bit into scripting MTA as well. I just couldn't find it. Sorry.
Moderators Citizen Posted March 6, 2011 Moderators Posted March 6, 2011 Hi, You can replay it like this: function playMySong( thePlayer, commandName ) playSound ( 'mysong.mp3' , true) end addCommandHandler( "play", playMySong, false, false ) addEventHandler ( "onClientResourceStart",getResourceRootElement(getThisResource()), playMySong ) Here the song is played when the resource is started, and when a player make the command /play You can also play the song in other functions like this: playMySong()
Castillo Posted March 6, 2011 Posted March 6, 2011 the last argument it's used to replay the sound already, no need to do a code for that.
Moderators Citizen Posted March 6, 2011 Moderators Posted March 6, 2011 the last argument it's used to replay the sound already, no need to do a code for that. LOOOL my bad ^^ I didn't see that
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