Jump to content
Mr. Green Gaming

My first map by: [Ocn]GreenBill


Recommended Posts

Here you go :

1st - go to this link and read a bit :P

2nd - I noticed that the link by BinSlayer is broken so --> copy the below into Notepad++ and save it as a .lua file called music (so final file should be "music.lua")

 

function startMusic()

    setRadioChannel(0)
    song = playSound("files/music.mp3",true)
outputChatBox("", 255, 0, 0, true)
outputChatBox("<------------------------------------->", 255, 0, 0, true)
outputChatBox("Knight Rider Theme (2008)", 255, 255, 0, true)
outputChatBox("Toggle music on/off using M", 0, 255, 128, true)
outputChatBox("<------------------------------------->", 255, 0, 0, true)
outputChatBox("", 255, 0, 0, true)
 
end
 
function makeRadioStayOff()
    setRadioChannel(0)
    cancelEvent()
end
 
function toggleSong()
    if not songOff then
   setSoundVolume(song,0)
songOff = true
removeEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff)
else
   setSoundVolume(song,1)
songOff = false
setRadioChannel(0)
addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff)
end
end
 
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),startMusic)
addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff)
addEventHandler("onClientPlayerVehicleEnter",getRootElement(),makeRadioStayOff)
addCommandHandler("mkmap1_racetheme",toggleSong)
bindKey("m","down","mkmap1_racetheme")

3rd - Download the song from zippyshare or with youtube downloader and put it in a new folder inside your map's main folder called "files". Name the song "music.mp3"

4th - Open your "meta.xml" file again with Notepad++ and copy paste the following lines anywhere under <meta> and above <settings>

 

<file src="files/music.mp3" />

<script src="music.lua" type="client" />

Now save your meta.xml file and go see if music works.

 

OPTIONAL : 

You may have noticed the "outputChatBox" lines in the music.lua I posted above. Those are just lines which show up in chat when your map starts. So in my case it showed one blank line, one with arrows after that, one with song name after that one, then the line which says with which key you stop music and finally another blank line.

And the 3 numbers are color codes for the text on each line.

All this is OPTIONAL. If you don't want to add song name or anything else, you can delete all lines. I'd advise you to keep the line which says with which button you can stop music as it makes it easier for players to turn off song if they don't like it [it's awesome btw :)]

So that's about it. Try it and let me know if you need any more help with your map.

 

D: HERE'S A VIDEO :D

Edited by MegasXLR
Link to comment
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...