Jump to content

duvida script


Recommended Posts

fiz um pequeno script que quando alguem aperta a letra z do teclado aparecer uma janela gui e quando apertar denovo ela desapareça 

só q quando eu aperto z quando a janela  gui está aberta ele duplica a janela, e n faz desaparecer

function tornarvisivel()
  showCursor(true)
local janela = guiCreateWindow( 434, 304, 280, 123, "Nova Janela", false)
end
if (guiGetVisible(janela) == true ) then
guiSetVisible(janela, false) else
guiSetVisible(janela, true)
end
bindKey("z", "down",tornarvisivel)

 

Edited by Murda
Link to comment
  • Other Languages Moderators

Crie a janela fora da função e logo em seguida torne ela invisível com guiSetVisible. Dai dentro da função vc apenas mostra/oculta essa janela com guiSetVisible também.

Link to comment
local janela = guiCreateWindow( 434, 304, 280, 123, "Nova Janela", false)
guiSetVisible(janela,false)
function tornarvisivel()
showCursor(true)
if guiGetVisible(janela) == false then
guiSetVisible(janela, true) else
guiSetVisible(janela,false)
end
bindKey("z", "down",tornarvisivel)
end

fiz como vc disse, mais agora eu aperto "z" e a janela n abre, mais nao apresenta nenhum erro no debug

Consegui resolver, era algo errado no bindkey, jjjjkk me desculpe 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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