Jump to content

[Ayuda] Cerrar ventana con boton


Recommended Posts

Hola de nuevo :D Estoy haciendo una ventana de comandos, que se abra con un comando, y se cierre con un botón, lo de abrirlo con un comando ya lo hice, pero no se como hacer para que se cierre con el botón (soy algo novato en script), me darían una ayuda?

Esta seria la ventana:

addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        VentanaComandos = guiCreateWindow(272, 208, 260, 103, "-AR- | Comandos", false) 
        guiWindowSetSizable(VentanaComandos, false) 
  
        cerrarPanel = guiCreateButton(202, 76, 48, 17, "Salir", false, VentanaComandos) 
        guiSetProperty(cerrarPanel, "NormalTextColour", "FFAAAAAA")     
    end 
) 

y esto uso para que se abra con el comando, es lo único que conseguí para que se abra, creo que esta mal

function onresourceStart () 
  addCommandHandler("comandos", PanelComandos) 
  guiSetVisible (VentanaComandos, false) 
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresourceStart) 
  
function PanelComandos () 
getVisible = guiGetVisible (VentanaComandos) 
playerName = getPlayerName ( getLocalPlayer() ) 
if (getVisible == true) then 
    guiSetVisible (VentanaComandos, false) 
    showCursor (false) 
end 
if (getVisible == false) then 
    guiSetVisible (VentanaComandos, true) 
    showCursor (true) 
    end 
end 

Si me pueden ayudar estaría muy agradecido :)

Link to comment
    function Panels() 
        Panels = guiCreateWindow(272, 208, 260, 103, "-AR- | Comandos", false) 
        guiWindowSetSizable(Panels, false) 
  
        cerrarPanel = guiCreateButton(202, 76, 48, 17, "Salir", false, Panels) 
        guiSetProperty(cerrarPanel, "NormalTextColour", "FFAAAAAA")     
         
showCursor ( true ) 
         
                             addEventHandler ( "onClientGUIClick", cerrarPanel, Exit, false ) 
         
    end 
     
addCommandHandler ( "ElComando", Panels ) 
     
    function Exit () 
     
    guiSetVisible (Panels, not guiGetVisible ( Panels ) ) 
             showCursor ( false ) 
     
    end 

Si Te Da Error Dimelo

----------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------

EDITADO:

y esto uso para que se abra con el comando, es lo único que conseguí para que se abra, creo que esta mal

function onresourceStart () 
  addCommandHandler("comandos", PanelComandos) 
  guiSetVisible (VentanaComandos, false) 
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresourceStart) 
  
function PanelComandos () 
getVisible = guiGetVisible (VentanaComandos) 
playerName = getPlayerName ( getLocalPlayer() ) 
if (getVisible == true) then 
    guiSetVisible (VentanaComandos, false) 
    showCursor (false) 
end 
if (getVisible == false) then 
    guiSetVisible (VentanaComandos, true) 
    showCursor (true) 
    end 
end 

Eso Nó Te Servirá.

Edited by Guest
Link to comment
    function Panels() 
        Panels = guiCreateWindow(272, 208, 260, 103, "-AR- | Comandos", false) 
        guiWindowSetSizable(Panels, false) 
  
        cerrarPanel = guiCreateButton(202, 76, 48, 17, "Salir", false, Panels) 
        guiSetProperty(cerrarPanel, "NormalTextColour", "FFAAAAAA")     
         
showCursor ( true ) 
         
                             addEventHandler ( "onClientGUIClick", cerrarPanel, Exit, false ) 
         
    end 
     
addCommandHandler ( "ElComando", Panels ) 
     
    function Exit () 
     
    guiSetVisible (Panels, not guiGetVisible ( Panels ) ) 
             showCursor ( false ) 
     
    end 

Si Te Da Error Dimelo

--------------------------------------------------------------------------------------------

EDITADO:

y esto uso para que se abra con el comando, es lo único que conseguí para que se abra, creo que esta mal

function onresourceStart () 
  addCommandHandler("comandos", PanelComandos) 
  guiSetVisible (VentanaComandos, false) 
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresourceStart) 
  
function PanelComandos () 
getVisible = guiGetVisible (VentanaComandos) 
playerName = getPlayerName ( getLocalPlayer() ) 
if (getVisible == true) then 
    guiSetVisible (VentanaComandos, false) 
    showCursor (false) 
end 
if (getVisible == false) then 
    guiSetVisible (VentanaComandos, true) 
    showCursor (true) 
    end 
end 

Eso Nó Te Servirá.

Funciona perfecto ! :D No da ningún error, gracias amigo :D

Link to comment
  • Recently Browsing   0 members

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