papam77 Posted April 26, 2013 Posted April 26, 2013 Hello, everybody know changing map in race - Next map starts in: 5 4 3 2 1 And i wanna add any song to chaning map. How can do it ?
Castillo Posted April 26, 2013 Posted April 26, 2013 -- server side: addEvent ( "onPostFinish", true ) addEventHandler ( "onPostFinish", root, function ( ) triggerClientEvent ( root, "playSound", root ) end ) -- client side: addEvent ( "playSound", true ) addEventHandler ( "playSound", root, function ( ) playSound ( "url or path here" ) end ) Not tested, I leave that part to you.
papam77 Posted April 26, 2013 Author Posted April 26, 2013 part of meta: song_c.lua addEvent ( "playSound", true ) addEventHandler ( "playSound", root, function ( ) playSound ( "song.mp3" ) end ) song_s.lua addEvent ( "onPostFinish", true ) addEventHandler ( "onPostFinish", root, function ( ) triggerClientEvent ( root, "playSound", root ) end ) Path: /s1.hrajminecraft.cz_22003/mods/deathmatch/resources/[eag]/main_eag/endsong And doesn't work while end.
Castillo Posted April 26, 2013 Posted April 26, 2013 You put wrong path @ playSound, should be: "endsong/song.mp3".
papam77 Posted April 26, 2013 Author Posted April 26, 2013 And is possible to stop song from map only ? Because it is double song
Castillo Posted April 26, 2013 Posted April 26, 2013 addEvent ( "playSound", true ) addEventHandler ( "playSound", root, function ( ) if ( isElement ( song ) ) then destroyElement ( song ) end song = playSound ( "endsong/song.mp3" ) end )
Castillo Posted April 26, 2013 Posted April 26, 2013 Ah, you want to stop it when a new map starts? if so, use onMapStarting event.
Castillo Posted April 26, 2013 Posted April 26, 2013 I already made you most of it, you must do this last part now.
iPrestege Posted April 26, 2013 Posted April 26, 2013 It's easy to change the event to onClientMapStarting !!
Castillo Posted April 26, 2013 Posted April 26, 2013 Yes, he can actually use that event and would be a lot easier.
papam77 Posted April 27, 2013 Author Posted April 27, 2013 local g_Root = getRootElement() local g_ResRoot = getResourceRootElement(getThisResource()) local soundVolume = 0.0 function vratitHlasitost () for i, sound in ipairs(getElementsByType("sound")) do setSoundVolume(sound, 1) end end addEvent ( "playSound", true ) addEventHandler ( "playSound", root, function ( ) if ( isElement ( song ) ) then destroyElement ( song ) end song = playSound ( "endsong/song.mp3" ) setSoundVolume(sound, soundVolume) setTimer(vratitHlasitost, 5000, 1) end ) addCommandHandler("soundvolume", function(cmd, value) soundVolume = value/100 outputConsole("set sound volume to "..value.."%") end ) And doesn't work
Castillo Posted April 27, 2013 Posted April 27, 2013 All you gotta do is combine: onClientMapStarting With: if ( isElement ( song ) ) then destroyElement ( song ) end
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