mg20023 Posted April 15, 2014 Share Posted April 15, 2014 Hello all. I created some lines in the login file that is playing sound when you login. How can i make it so when the player logged in the music stops? Here is the CLIENT SIDE script: addEventHandler("accounts:login:request", getRootElement(), function () setElementDimension ( getLocalPlayer(), 1 ) setElementInterior( getLocalPlayer(), 0 ) setCameraMatrix( -422.671875, 1033.791015625, 78.619026184082, -289.427734375, 1110.6357421875, 24.005138397217) setCloudsEnabled(false) fadeCamera(true) guiSetInputEnabled(true) clearChat() LoginScreen_openLoginScreen() local sound = playSound ( "http://localhost/files/sounds/roleplay/gtav.mp3", true ) -- Convidence setSoundVolume(sound, 0.3) setSoundMaxDistance(sound, 100) setElementDimension(sound, 1) setElementInterior(sound, 0) -- Old end ); Link to comment
Woovie Posted April 15, 2014 Share Posted April 15, 2014 You'll need to use these events and functions. Serverside Add a handler for onPlayerLogin https://wiki.multitheftauto.com/wiki/OnPlayerLogin Make it fire triggerClientEvent with event "onClientPlayerLogin" https://wiki.multitheftauto.com/wiki/TriggerClientEvent Client Add a new event called "onClientPlayerLogin" using addEvent https://wiki.multitheftauto.com/wiki/AddEvent Add an event handler for "onClientPlayerLogin" and cause it to trigger like this addEventHandler ( "onClientPlayerLogin", root, function() stopSound ( sound ) end ) Link to comment
mg20023 Posted April 16, 2014 Author Share Posted April 16, 2014 It worked Thanks for helping Close topic please. Link to comment
Recommended Posts