Julian09123 Posted September 12, 2013 Posted September 12, 2013 Hola amigos bueno como veran antes publique como hacer un panel music bueno no tube tiempo asique lo hare ahora. Bueno quiero que cuando apretes el boton se repoduzca la cansion pero no intento hacer eso o nose como va ubicado el playSound Anda pero al poner start desaparece el boton y se escucha la musica sin apretar nada GUIEditor = { button = {}, window = {}, } function pan() GUIEditor.window[1] = guiCreateWindow(154, 123, 510, 420, "", false) guiWindowSetSizable(GUIEditor.window[1], false) Bang = guiCreateButton(154, 203, 114, 32, "Bangarang", playSound("Musica/Bang.mp3"), false) First = guiCreateButton(286, 203, 114, 32, "First of the year", false) Rock = guiCreateButton(547, 203, 114, 32, "Rock n roll", false) Cinema = guiCreateButton(419, 203, 114, 32, "Cinema", false) end addEventHandler("onClientResourceStart", resourceRoot, pan ) addEventHandler("onClientRender", root, function() dxDrawRectangle(154, 91, 509, 49, tocolor(255, 0, 0, 255), true) dxDrawText("Panel de Musica -AR-", 221, 99, 625, 135, tocolor(255, 255, 255, 255), 1, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Skrillex:", 154, 154, 286, 185, tocolor(255, 255, 255, 255), 1, "bankgothic", "left", "top", false, false, true, false, false) end )
Castillo Posted September 12, 2013 Posted September 12, 2013 Tenes que usar el evento onClientGUIClick.
Julian09123 Posted September 13, 2013 Author Posted September 13, 2013 Bien pero reemplazo onResourceStart por onClientGUIClick? y haci esto esta bien? Bang = guiCreateButton(154, 203, 114, 32, "Bangarang", playSound("Musica/Bang.mp3"), false)
Julian09123 Posted September 13, 2013 Author Posted September 13, 2013 Entonces que hago? me explicas un poco mejor?
TheCrazy17 Posted September 13, 2013 Posted September 13, 2013 Entonces que hago? me explicas un poco mejor? Creo que es así GUIEditor = { button = {}, window = {}, } function pan() GUIEditor.window[1] = guiCreateWindow(154, 123, 510, 420, "", false) guiWindowSetSizable(GUIEditor.window[1], false) Bang = guiCreateButton(154, 203, 114, 32, "Bangarang", false) First = guiCreateButton(286, 203, 114, 32, "First of the year", false) Rock = guiCreateButton(547, 203, 114, 32, "Rock n roll", false) Cinema = guiCreateButton(419, 203, 114, 32, "Cinema", false) end addEventHandler("onClientResourceStart", resourceRoot, pan ) addEventHandler("onClientRender", root, function() dxDrawRectangle(154, 91, 509, 49, tocolor(255, 0, 0, 255), true) dxDrawText("Panel de Musica -AR-", 221, 99, 625, 135, tocolor(255, 255, 255, 255), 1, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Skrillex:", 154, 154, 286, 185, tocolor(255, 255, 255, 255), 1, "bankgothic", "left", "top", false, false, true, false, false) end ) function bangarang() if source == Bang then local sonido = playSound("Musica/Bang.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), bangarang)
Julian09123 Posted September 13, 2013 Author Posted September 13, 2013 Entonces que hago? me explicas un poco mejor? Creo que es así GUIEditor = { button = {}, window = {}, } function pan() GUIEditor.window[1] = guiCreateWindow(154, 123, 510, 420, "", false) guiWindowSetSizable(GUIEditor.window[1], false) Bang = guiCreateButton(154, 203, 114, 32, "Bangarang", false) First = guiCreateButton(286, 203, 114, 32, "First of the year", false) Rock = guiCreateButton(547, 203, 114, 32, "Rock n roll", false) Cinema = guiCreateButton(419, 203, 114, 32, "Cinema", false) end addEventHandler("onClientResourceStart", resourceRoot, pan ) addEventHandler("onClientRender", root, function() dxDrawRectangle(154, 91, 509, 49, tocolor(255, 0, 0, 255), true) dxDrawText("Panel de Musica -AR-", 221, 99, 625, 135, tocolor(255, 255, 255, 255), 1, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Skrillex:", 154, 154, 286, 185, tocolor(255, 255, 255, 255), 1, "bankgothic", "left", "top", false, false, true, false, false) end ) function bangarang() if source == Bang then local sonido = playSound("Musica/Bang.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), bangarang) Listo Gracias y te habia faltado el ) para cerrar el addEventHandler ya lo arregle gracias
Julian09123 Posted September 13, 2013 Author Posted September 13, 2013 Tengo otro problema como hago para que cuando Pongas otra cansion osea apretar otro boton se pare la otra musica y la que apretaste empieze a escucharse? y tambien cree un boton de stopSound pero no anda Esta mal? function par() if source == parar then local sonido = stopSound( source ) setSoundVolume(sonido, 0.0) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), par )
Castillo Posted September 13, 2013 Posted September 13, 2013 Quitale el "local" enfrente de sonido = playSound ( ) en el otro codigo, luego pone stopSound ( sonido ) en la funcion "par".
Julian09123 Posted September 13, 2013 Author Posted September 13, 2013 Quitale el "local" enfrente de sonido = playSound ( ) en el otro codigo, luego pone stopSound ( sonido ) en la funcion "par". Me anda bien ahora hice todo pero cuando apreto a la ventana los botones como que se ponen detras de la ventana y no deja seleccionarlos mira
Castillo Posted September 13, 2013 Posted September 13, 2013 Pone los botones como parent de la ventana.
Julian09123 Posted September 13, 2013 Author Posted September 13, 2013 Pone los botones como parent de la ventana. como parent? como?
Castillo Posted September 13, 2013 Posted September 13, 2013 First = guiCreateButton(286, 203, 114, 32, "First of the year", false, GUIEditor.window[1]) Asi.
Julian09123 Posted September 13, 2013 Author Posted September 13, 2013 First = guiCreateButton(286, 203, 114, 32, "First of the year", false, GUIEditor.window[1]) Asi. Ah gracias :3
Julian09123 Posted September 13, 2013 Author Posted September 13, 2013 Ahora el Problema es que cuando lo prendo me aparece los botones mas abajo y faltan botones mira
Castillo Posted September 13, 2013 Posted September 13, 2013 Debe ser porque creaste los botones con la posicion sin parent, tenes que moverlos.
Julian09123 Posted September 13, 2013 Author Posted September 13, 2013 Hay los movi pero me faltan 3 botones que no aparecen Edit: no no puedo moverlos como hago?
Castillo Posted September 13, 2013 Posted September 13, 2013 Cambia la posicion, tan simple como eso.
Julian09123 Posted September 13, 2013 Author Posted September 13, 2013 Solid nose no puedo me faltan 3 botones que no aparecen GUIEditor = { button = {}, window = {}, } function pan() GUIEditor.window[1] = guiCreateWindow(154, 123, 510, 420, "", false) guiWindowSetSizable(GUIEditor.window[1], false) Bang = guiCreateButton(10, 73, 114, 32, "Bangarang", false, GUIEditor.window[1]) First = guiCreateButton(146, 73, 114, 32, "First of the year", false, GUIEditor.window[1]) Rock = guiCreateButton(547, 203, 0, 32, "Rock n roll", false, GUIEditor.window[1]) Cinema = guiCreateButton(284, 73, 92, 32, "Cinema", false, GUIEditor.window[1]) End = guiCreateButton(10, 164, 118, 31, "In The End", false, GUIEditor.window[1]) One = guiCreateButton(146, 164, 118, 31, "One step closer", false, GUIEditor.window[1]) New = guiCreateButton(285, 164, 91, 31, "New Divide", false, GUIEditor.window[1]) My = guiCreateButton(546, 286, 0, 31, "By Myself", false, GUIEditor.window[1]) parar = guiCreateButton(574, 512, 0, 0, "Parar Musica", false, GUIEditor.window[1]) end addEventHandler("onClientResourceStart", resourceRoot, pan ) addEventHandler("onClientRender", root, function() dxDrawRectangle(154, 91, 509, 49, tocolor(255, 0, 0, 255), true) dxDrawText("Panel de Musica -AR-", 221, 99, 625, 135, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Skrillex:", 154, 154, 286, 185, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Linkin Park:", 152, 246, 654, 277, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, true, false, false) end ) function bangarang() if source == Bang then sonido = playSound("Musica/Bang.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), bangarang ) function first() if source == First then sonido = playSound("Musica/First.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), first ) function rock() if source == Rock then sonido = playSound("Musica/Rock.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), rock ) function ci() if source == Cinema then sonido = playSound("Musica/Cinema.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), ci ) function inthe() if source == End then sonido = playSound("Musica/End.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), inthe ) function one() if source == One then sonido = playSound("Musica/One.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), one ) function by() if source == My then sonido = playSound("Musica/My.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), by ) function nue() if source == New then sonido = playSound("Musica/New.mp3") setSoundVolume(sonido, 0.5) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), nue ) function par() if source == parar then sonido = stopSound( sonido ) setSoundVolume(sonido, 0.0) end end addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), par )
Recommended Posts