Julian09123 Posted April 11, 2014 Posted April 11, 2014 Hola amigos de la comu. Me podrian decir como hago para que al clickear la Dx se cierre Todo? dejo el codigo del boton. function BotonCerrar(button, state) if state == "up" then return end if visible == true then local CursorX, CursorY = getCursorPosition() if CursorX >= 0.44749999046326 and CursorX <= 0.59874999523163 and CursorY >= 0.80000001192093 and CursorY <= 0.85333335399628 then end end end addEventHandler("onClientClick", getRootElement(), BotonCerrar) Pondre Code ya que [lua] no funciona
Julian09123 Posted April 11, 2014 Author Posted April 11, 2014 Me darias un ejemplo ? es que no entiendo el de la wiki gracias
Tomas Posted April 12, 2014 Posted April 12, 2014 function eldxwachin () dxDrawText ( ... ) end addEventHandler ( "onClientRender", root, eldxwachin) function chaudx() removeEventHandler ( "onClientRender", root, eldxwachin) --Removes el event handler end addCommandHandler("quitardx", chaudx) Ahi te di un sencillo ejemplo de quitarlo con un comando.
Jacobob14 Posted April 12, 2014 Posted April 12, 2014 aca tienes un ejemplo simple de una parte de mi help panel D: staffbtn = guiCreateButton(520, 192, 64, 28, "", false) rulesbtn = guiCreateButton(334, 388, 108, 34, "", false) guiSetVisible(staffbtn, false) guiSetVisible(rulesbtn, false) function drawPanel() dxDrawRectangle(313, 166, 276, 343, tocolor(4, 4, 4, 116), false) dxDrawRectangle(313, 166, 276, 22, tocolor(0, 0, 0, 254), false) dxDrawText("............", 340, 170, 594, 182, tocolor(255, 255, 255, 255), 0.40, "bankgothic", "left", "top", false, false, true, false, false) function showPanel() if (guiGetVisible (staffbtn) == false) then guiSetVisible(staffbtn, true) guiSetVisible(rulesbtn, true) showCursor(true) addEventHandler("onClientRender", root, drawPanel) elseif (guiGetVisible (staffbtn) == true) then guiSetVisible(staffbtn, false) guiSetVisible(rulesbtn, false) showCursor(false) removeEventHandler("onClientRender", root, drawPanel) end end bindKey ("F9", "down", showPanel)
Julian09123 Posted April 12, 2014 Author Posted April 12, 2014 Los 2 no me sirven ya que lo que trato de hacer es utilizando getCursorPostion y no GUI. Tomasito lo que quiero hacer es que al apretar un rectangulo que ya esta posicionado osea ya saque las posiciones se cierre el panel.
Tomas Posted April 12, 2014 Posted April 12, 2014 Acaso quieres que te de el script en la mano? .-. Obviamente no te servirá, son scripts totalmente distintos, te di una base para que te apoyes.
Tomas Posted April 12, 2014 Posted April 12, 2014 Prueba con esto: Nota: Lee abajo debes editar algo! function BotonCerrar(button, state) if state == "up" then return end if visible == true then local CursorX, CursorY = getCursorPosition() if CursorX >= 0.44749999046326 and CursorX <= 0.59874999523163 and CursorY >= 0.80000001192093 and CursorY <= 0.85333335399628 then removeEventHandler("onClientRender", getRootElement(), ElNombreDeLaFuncionConLaCualCreasteLosDX) end end end addEventHandler("onClientClick", getRootElement(), BotonCerrar) Usen [ code=lua ] [ /code ] ._.
Jacobob14 Posted April 12, 2014 Posted April 12, 2014 (edited) mmm seria mas facil si pusieras un boton debajo del dxRexctangle con 0 de alpha asi no te complicas la vida si te animas aca un ejemplo D: local ap1=255 local ap2=255 cerrar = guiCreateButton(520, 192, 64, 28, "", false) addEventHandler( "onClientMouseEnter",staffbtn,function() re=50 end) addEventHandler("onClientMouseLeave",staffbtn,function() re=255 end) aaaa = guiCreateButton(334, 388, 108, 34, "", false) addEventHandler( "onClientMouseEnter",rulesbtn,function() re=255 end) addEventHandler("onClientMouseLeave",rulesbtn,function() re=50 end) function drawPanel() dxDrawRectangle(520, 192, 64, 28, tocolor(4, 4, 4, ap1), false) dxDrawRectangle(334, 388, 108, 34, tocolor(0, 0, 0, ap2), false) function showPanel() guiSetVisible(staffbtn, false) guiSetVisible(rulesbtn, false) removeEventHandler("onClientRender", root, drawPanel) end addEventHandler("onClientGUIClick", cerrar, showPanel) Edited April 12, 2014 by Guest
Tomas Posted April 12, 2014 Posted April 12, 2014 Dudo que quiera cambiar eso ahora. Hace días o semanas está pidiendo ayuda con el DX ._. Cuando carajo entenderán :C [ code=lua ] [ /code ]
Alexs Posted April 12, 2014 Posted April 12, 2014 mmm seria mas facil si pusieras un boton debajo del dxRexctangle con 0 de alpha asi no te complicas la vidasi te animas aca un ejemplo D: En términos de eficiencia, eso es una idea horrible, es mejor el método que esta utilizando actualmente.
Julian09123 Posted April 12, 2014 Author Posted April 12, 2014 SOLUCIONADO! en unas horas podras probarlo :3 lo subire a la comunidad.. Gracias
Julian09123 Posted April 13, 2014 Author Posted April 13, 2014 No se ni lo probe.Ya lo habia arreglado, habia pensado que tal cambiar esto por esto y esto por esto y bueh funciono
Recommended Posts