Overkillz Posted June 15, 2014 Share Posted June 15, 2014 Hey newly, I have a problem with the playsound, I can't hear my song when I login in my server - Client function surprise () local sound = playSound("surprise.mp3") setSoundVolume(sound, 1.0) end addEventHandler("onPlayerLogin", getLocalPlayer(), surprise) - Meta "surprise.mp3" /> I hope you can help me Link to comment
xXMADEXx Posted June 15, 2014 Share Posted June 15, 2014 onPlayerLogin is a server event. You can use onClientResourceStart or trigger a client event when onPlayerLogin is triggered. Link to comment
Max+ Posted June 15, 2014 Share Posted June 15, 2014 Well as it's shown in wiki playSound ClientSide, and onPlayerLogin is serverSide Event what we should do ? - Use triggerClientEvent - on Server - Add the Event to ClientSide -------ServerSide addEventHandler('onPlayerLogin', root, function ( ) triggerClientEvent(source, 'PlaySound', source ) end ) -------ClientSide addEvent('PlaySound', true) addEventHandler('PlaySound', root, function ( ) local sound = playSound("surprise.mp3") setSoundVolume(sound, 1.0) 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