Clan 303
Would you like to react to this message? Create an account in a few clicks or log in to continue.


Clan 303, Best clan ever :D.
 
HomePortalLatest imagesSearchRegisterLog in

 

 [TUT]:How To Add Music To Your Map?

Go down 
AuthorMessage
Deimos




Posts : 44
Join date : 2010-11-24
Age : 30

[TUT]:How To Add Music To Your Map? Empty
PostSubject: [TUT]:How To Add Music To Your Map?   [TUT]:How To Add Music To Your Map? Icon_minitimeWed Nov 24, 2010 8:54 pm

Hello Today u will Learn How to add music to your map !
How it works ? - When Map starts The music goes u can stopt it with Button

Ok let's Start !

make a new text document and add .lua at the end and add this line in the meta.XML -
Quote from:
<script src="nameofthescript.lua"
And Add this -
Quote from:
<file src="yoursongname" />

Next-

Add This script to your created notepad !

Quote from:
function startMusic()
setRadioChannel(0)
song = playSound("music.mp3",true)
outputChatBox("Toggle music on/off using B important:Custom map cannot be played 2 time in a row")
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("musicmusic",toggleSong)
bindKey("b","down","musicmusic")
addEventHandler("onClientResourceStop",getResourceRootElement(getThisResource()),startMusic)


song = playSound("music.mp3",true) - Replace music.mp3 with your song
Add your song to Map folder ! . P.S Music name must named as in the script !

The End
Back to top Go down
 
[TUT]:How To Add Music To Your Map?
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Clan 303 :: Tutorials :: Tutorial camp-
Jump to: