papam77 Posted April 26, 2013 Share 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 ? Link to comment
Castillo Posted April 26, 2013 Share 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. Link to comment
papam77 Posted April 26, 2013 Author Share 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. Link to comment
Castillo Posted April 26, 2013 Share Posted April 26, 2013 You put wrong path @ playSound, should be: "endsong/song.mp3". Link to comment
papam77 Posted April 26, 2013 Author Share Posted April 26, 2013 Oh, my bad sorry. Work it Thank you Link to comment
papam77 Posted April 26, 2013 Author Share Posted April 26, 2013 And is possible to stop song from map only ? Because it is double song Link to comment
Castillo Posted April 26, 2013 Share Posted April 26, 2013 addEvent ( "playSound", true ) addEventHandler ( "playSound", root, function ( ) if ( isElement ( song ) ) then destroyElement ( song ) end song = playSound ( "endsong/song.mp3" ) end ) Link to comment
papam77 Posted April 26, 2013 Author Share Posted April 26, 2013 song from map still playing Link to comment
Castillo Posted April 26, 2013 Share Posted April 26, 2013 Ah, you want to stop it when a new map starts? if so, use onMapStarting event. Link to comment
papam77 Posted April 26, 2013 Author Share Posted April 26, 2013 Sorry, i can't use it i am beginner Link to comment
Castillo Posted April 26, 2013 Share Posted April 26, 2013 I already made you most of it, you must do this last part now. Link to comment
iPrestege Posted April 26, 2013 Share Posted April 26, 2013 It's easy to change the event to onClientMapStarting !! Link to comment
Castillo Posted April 26, 2013 Share Posted April 26, 2013 Yes, he can actually use that event and would be a lot easier. Link to comment
papam77 Posted April 27, 2013 Author Share 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 Link to comment
Castillo Posted April 27, 2013 Share Posted April 27, 2013 All you gotta do is combine: onClientMapStarting With: if ( isElement ( song ) ) then destroyElement ( song ) end Link to comment
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