Jump to content

Cerrar


Recommended Posts

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

Link to comment
  
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.

Link to comment

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)

Link to comment

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 ]

._.

Link to comment

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 by Guest
Link to comment
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:

En términos de eficiencia, eso es una idea horrible, es mejor el método que esta utilizando actualmente.

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...