TrapLord Studios™ Posted November 14, 2013 Posted November 14, 2013 How could I play a .mp3 File when the player joins at the Login Screen and makes it stop after they've logged in? -Thank You
TAPL Posted November 14, 2013 Posted November 14, 2013 -- Client Side -- JoinMusic = playSound(...) addEvent("onLogin", true) addEventHandler("onLogin", root, function() if isElement(JoinMusic) then destroyElement(JoinMusic) end end) -- Server Side -- addEventHandler("onPlayerLogin", root, function() triggerClientEvent(source, "onLogin", source) end)
TrapLord Studios™ Posted November 14, 2013 Author Posted November 14, 2013 I have a little problem, after you login it doesn't stop, it just continues and eventually stops.
TAPL Posted November 14, 2013 Posted November 14, 2013 Anything in the debug? Are you sure the server side set correctly?
TrapLord Studios™ Posted November 14, 2013 Author Posted November 14, 2013 Nothing in the server side. This is the server side - addEventHandler("onPlayerLogin", root, function() triggerClientEvent(source, "onLogin", source) end) Btw is it possible to loop the sound? -
TAPL Posted November 14, 2013 Posted November 14, 2013 Set looped argument to true. JoinMusic = playSound("song.mp3", true) Try this for debug and see if it output or not. addEventHandler("onPlayerLogin", root, function() outputChatBox("Login!") triggerClientEvent(source, "onLogin", source) end) addEvent("onLogin", true) addEventHandler("onLogin", root, function() outputChatBox("Trigger!") if isElement(JoinMusic) then outputChatBox("Destroy!") destroyElement(JoinMusic) end end)
TrapLord Studios™ Posted November 14, 2013 Author Posted November 14, 2013 The Trigger & Login Text is outputter but the Destroy text doesn't come up.
TAPL Posted November 14, 2013 Posted November 14, 2013 Try this: addEvent("onLogin", true) addEventHandler("onLogin", root, function() outputChatBox("Trigger!") stopSound(JoinMusic) end) Edit: did you change the variable JoinMusic? because i test it and it worked.
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