Jump to content

Music


bartje01

Recommended Posts

Posted

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

Posted
addEventHandler ( "onClientResourceStart", resourceRoot, 
    function ( ) 
        playSound ( 'mysong.mp3' ) -- put the song in your map folder 
    end 
) 

Posted

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?

Posted

@ 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 ?

Posted

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

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

Posted

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 
) 

Posted

@ 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

Posted

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

Posted

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
Posted

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() 

  • Moderators
Posted
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 :mrgreen:

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