proracer Posted January 2, 2011 Share Posted January 2, 2011 So for test I created some simple Media Player with GUI Window and DX Lines and text.I wanna play a sound when someone clicks on: "Listen" but it doesn't. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() GUIEditor_Grid = {} showCursor(true,true) Local_Media_Player_Window = guiCreateWindow(536,120,806,637,"Local Media Player",false) guiWindowSetSizable(Local_Media_Player_Window,false) Listen_Button_1 = guiCreateButton(90,25,186,65,"Listen",false,Local_Media_Player_Window) addEventHandler( "onClientGUIClick", Listen_Button_1, listenButton1 ) end ) -- Direct X Drawing addEventHandler("onClientRender",root, function() dxDrawText("DJ Ravine - Listen to your heart",959.0,161.0,1330.0,251.0,tocolor(255,255,255,255),0.7,"bankgothic","left","top",false,false,false) dxDrawLine(538.0,252.0,1339.0,252.0,tocolor(255,255,255,255),1.0,false) dxDrawLine(940.0,141.0,940.0,754.0,tocolor(255,255,255,255),1.0,false) end ) function listenButton1 (button) if button == "left" then local sound = playSound("sounds/sound1.mp3") --Play sound setSoundVolume(sound, 0.75) end end That is the code.By the way I hope I put sound correctly.I made folder in "LocalMediaPlayer" resource and in "sounds" folder there is "sound1.mp3".MTA Script Editor outputs no errors. Link to comment
Aibo Posted January 2, 2011 Share Posted January 2, 2011 have you added your sound to meta.xml? Link to comment
proracer Posted January 2, 2011 Author Share Posted January 2, 2011 I didn't but now when I put it it loads music file (3.4 mb) but won't play the sound when I press "Listen". 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