Phoenixx Posted October 22, 2013 Share Posted October 22, 2013 How do i make some music play when I login/connect to server .. ? ~I already have something like : --Playsound "winsound.mp3 (true) or something like that but it doesn't works .. Link to comment
isa_Khamdan Posted October 22, 2013 Share Posted October 22, 2013 How do i make some music play when I login/connect to server .. ? ~I already have something like : --Playsound "winsound.mp3 (true) or something like that but it doesn't works .. use onPlayerLogin playSound Link to comment
-.Paradox.- Posted October 22, 2013 Share Posted October 22, 2013 Try Server side addEventHandler('onPlayerLogin', getRootElement(), function() triggerClientEvent('startSound', getRootElement(), 'login') end ) Client side local sounds = { ['login'] = 'winsound.mp3' } function startSound(sound) playSound(sounds[sound], false) end addEvent('startSound', true) addEventHandler('startSound', getRootElement(), startSound) Link to comment
BieHDC Posted October 23, 2013 Share Posted October 23, 2013 With this example above it will play for ALL players on Server if you wanna it only for the Player who joined then change this line triggerClientEvent('startSound', getRootElement(), 'login') to triggerClientEvent('startSound', source, 'login') Link to comment
Phoenixx Posted October 24, 2013 Author Share Posted October 24, 2013 --BUILD WINDOW ON RESOURCE START addEventHandler("onClientResourceStart", resourceRoot, function () build_loginWin() guiSetVisible(background_front,false) showLoginWindow(true) guiSetInputMode("no_binds_when_editing") --playSound("winsound.mp3") fadeCamera (true) setCameraMatrix(1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) end ) Link to comment
J.S. Posted October 24, 2013 Share Posted October 24, 2013 Putting "--" before something comments it out (the code is not executed) Removing the dashes before playSound should make it work. Link to comment
xXMADEXx Posted October 25, 2013 Share Posted October 25, 2013 Plain & Simple ((N Server: addEventHandler ( "onPlayerLogin", root, function ( ) triggerClientEvent ( source, 'onplayerclientlogin', source ) end ) --client: addEvent ( 'onplayerclientlogin', true ) addEventHandler ( "onplayerclientlogin", root, function ( ) playSound ( "winsound.mp3" ) end ) Link to comment
Diverti Posted October 25, 2013 Share Posted October 25, 2013 Add this line to meta xml: Or try to put the Sound3D where the camera is. And if it's works, need to work the local sound Link to comment
Phoenixx Posted October 26, 2013 Author Share Posted October 26, 2013 and the two -- before code play sound (winsound.mp3) when i remove 1 - or 2 -- login breaks and just black screen appears Thx for help all i'll try this Link to comment
iiDoGz Posted November 7, 2013 Share Posted November 7, 2013 but where do I put these scripts , what file or file's. Link to comment
TAPL Posted November 7, 2013 Share Posted November 7, 2013 but where do I put these scripts , what file or file's. https://wiki.multitheftauto.com/wiki/Scripting_Introduction Link to comment
Phoenixx Posted November 9, 2013 Author Share Posted November 9, 2013 Ya.... sound plays , ( i got file winsound.mp3 , and it plays the random song) , if i replace my own winsound.mp3 , it still plays random WINSOUND == Link to comment
mint3d Posted November 9, 2013 Share Posted November 9, 2013 Add this line to meta xml: Add that as he said Link to comment
Saml1er Posted November 11, 2013 Share Posted November 11, 2013 Ya.... sound plays , ( i got file winsound.mp3 , and it plays the random song) , if i replace my own winsound.mp3 , it still plays random WINSOUND == Use this function before using playSound. setRadioChannel ( 0 ) 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