Jump to content

Panel - bindKey - Error


Recommended Posts

Posted

Hola, hace rato hice un panel y todo funciona perfecto menos el bindKey.

El bindKey funciona bien, pero el panel también se abre cuando se inicia el resource o cuando un jugador se conecta.

local screenW, screenH = guiGetScreenSize() 
ventana = guiCreateWindow((screenW - 456) / 2, (screenH - 307) / 2, 456, 307, ".-Tienda Zenbeit-.", false) 
guiWindowSetSizable(ventana, false) 
  
botonvida = guiCreateButton(9, 22, 97, 21, "Vida [100]", false, ventana) 
botonarmadura = guiCreateButton(9, 53, 97, 21, "Armadura [100]", false, ventana) 
botonminigun = guiCreateButton(349, 25, 97, 18, "Minigun [100]", false, ventana) 
botonbazooka = guiCreateButton(349, 56, 97, 18, "Bazooka [10]", false, ventana) 
guiLabelSetVerticalAlign(preciovida, "center") 
precioarmadura = guiCreateLabel(106, 53, 37, 21, "$400", false, ventana) 
guiLabelSetHorizontalAlign(precioarmadura, "center", false) 
guiLabelSetVerticalAlign(precioarmadura, "center") 
preciominigun = guiCreateLabel(297, 25, 47, 21, "$50.000", false, ventana) 
guiLabelSetVerticalAlign(preciominigun, "center") 
preciobazooka = guiCreateLabel(297, 56, 47, 18, "$50.000", false, ventana) 
guiLabelSetHorizontalAlign(preciobazooka, "center", false) 
guiLabelSetVerticalAlign(preciobazooka, "center") 
botonhunter = guiCreateButton(9, 237, 97, 21, "Hunter", false, ventana) 
botonhydra = guiCreateButton(9, 268, 97, 21, "Hydra", false, ventana) 
preciohunter = guiCreateLabel(106, 237, 56, 21, "$100.000", false, ventana) 
guiLabelSetVerticalAlign(preciohunter, "center") 
preciohydra = guiCreateLabel(106, 268, 56, 21, "$100.000", false, ventana) 
guiLabelSetVerticalAlign(preciohydra, "center") 
preciorhino = guiCreateLabel(292, 268, 57, 21, "$100.000", false, ventana) 
guiLabelSetVerticalAlign(preciorhino, "center") 
precioseas = guiCreateLabel(287, 240, 62, 18, "$100.000", false, ventana) 
guiLabelSetHorizontalAlign(precioseas, "center", false) 
guiLabelSetVerticalAlign(precioseas, "center") 
botonrhino = guiCreateButton(349, 271, 97, 18, "Rhino", false, ventana) 
botonseas = guiCreateButton(349, 240, 97, 18, "Seasparrow", false, ventana) 
imagen = guiCreateStaticImage(143, 98, 172, 99, ":Zombies/edf/zombiespawn.png", false, ventana) 
guiSetAlpha(imagen, 0.43) 
  
function OpenWin() 
    if guiGetVisible(ventana) then 
       guiSetVisible(ventana, false) 
       showCursor(false) 
    else 
        guiSetVisible(ventana, true) 
        showCursor(true) 
    end 
end 
bindKey("F7", "down", OpenWin) 

Posted
local screenW, screenH = guiGetScreenSize() 
  
addEventHandler("onClientResourceStart", resourceRoot, 
function() 
    ventana = guiCreateWindow((screenW - 456) / 2, (screenH - 307) / 2, 456, 307, ".-Tienda Zenbeit-.", false) 
    guiWindowSetSizable(ventana, false) 
    botonvida = guiCreateButton(9, 22, 97, 21, "Vida [100]", false, ventana) 
    botonarmadura = guiCreateButton(9, 53, 97, 21, "Armadura [100]", false, ventana) 
    botonminigun = guiCreateButton(349, 25, 97, 18, "Minigun [100]", false, ventana) 
    botonbazooka = guiCreateButton(349, 56, 97, 18, "Bazooka [10]", false, ventana) 
    guiLabelSetVerticalAlign(preciovida, "center") 
    precioarmadura = guiCreateLabel(106, 53, 37, 21, "$400", false, ventana) 
    guiLabelSetHorizontalAlign(precioarmadura, "center", false) 
    guiLabelSetVerticalAlign(precioarmadura, "center") 
    preciominigun = guiCreateLabel(297, 25, 47, 21, "$50.000", false, ventana) 
    guiLabelSetVerticalAlign(preciominigun, "center") 
    preciobazooka = guiCreateLabel(297, 56, 47, 18, "$50.000", false, ventana) 
    guiLabelSetHorizontalAlign(preciobazooka, "center", false) 
    guiLabelSetVerticalAlign(preciobazooka, "center") 
    botonhunter = guiCreateButton(9, 237, 97, 21, "Hunter", false, ventana) 
    botonhydra = guiCreateButton(9, 268, 97, 21, "Hydra", false, ventana) 
    preciohunter = guiCreateLabel(106, 237, 56, 21, "$100.000", false, ventana) 
    guiLabelSetVerticalAlign(preciohunter, "center") 
    preciohydra = guiCreateLabel(106, 268, 56, 21, "$100.000", false, ventana) 
    guiLabelSetVerticalAlign(preciohydra, "center") 
    preciorhino = guiCreateLabel(292, 268, 57, 21, "$100.000", false, ventana) 
    guiLabelSetVerticalAlign(preciorhino, "center") 
    precioseas = guiCreateLabel(287, 240, 62, 18, "$100.000", false, ventana) 
    guiLabelSetHorizontalAlign(precioseas, "center", false) 
    guiLabelSetVerticalAlign(precioseas, "center") 
    botonrhino = guiCreateButton(349, 271, 97, 18, "Rhino", false, ventana) 
    botonseas = guiCreateButton(349, 240, 97, 18, "Seasparrow", false, ventana) 
    imagen = guiCreateStaticImage(143, 98, 172, 99, ":Zombies/edf/zombiespawn.png", false, ventana) 
    guiSetAlpha(imagen, 0.43) 
    guiSetVisible(ventana, false) 
end) 
  
function OpenWin() 
    if guiGetVisible(ventana) then 
       guiSetVisible(ventana, false) 
       showCursor(false) 
    else 
        guiSetVisible(ventana, true) 
        showCursor(true) 
    end 
end 
bindKey("F7", "down", OpenWin) 

Posted
Hola, hace rato hice un panel y todo funciona perfecto menos el bindKey.

El bindKey funciona bien, pero el panel también se abre cuando se inicia el resource o cuando un jugador se conecta.

local screenW, screenH = guiGetScreenSize() 
ventana = guiCreateWindow((screenW - 456) / 2, (screenH - 307) / 2, 456, 307, ".-Tienda Zenbeit-.", false) 
guiWindowSetSizable(ventana, false) 
  
botonvida = guiCreateButton(9, 22, 97, 21, "Vida [100]", false, ventana) 
botonarmadura = guiCreateButton(9, 53, 97, 21, "Armadura [100]", false, ventana) 
botonminigun = guiCreateButton(349, 25, 97, 18, "Minigun [100]", false, ventana) 
botonbazooka = guiCreateButton(349, 56, 97, 18, "Bazooka [10]", false, ventana) 
guiLabelSetVerticalAlign(preciovida, "center") 
precioarmadura = guiCreateLabel(106, 53, 37, 21, "$400", false, ventana) 
guiLabelSetHorizontalAlign(precioarmadura, "center", false) 
guiLabelSetVerticalAlign(precioarmadura, "center") 
preciominigun = guiCreateLabel(297, 25, 47, 21, "$50.000", false, ventana) 
guiLabelSetVerticalAlign(preciominigun, "center") 
preciobazooka = guiCreateLabel(297, 56, 47, 18, "$50.000", false, ventana) 
guiLabelSetHorizontalAlign(preciobazooka, "center", false) 
guiLabelSetVerticalAlign(preciobazooka, "center") 
botonhunter = guiCreateButton(9, 237, 97, 21, "Hunter", false, ventana) 
botonhydra = guiCreateButton(9, 268, 97, 21, "Hydra", false, ventana) 
preciohunter = guiCreateLabel(106, 237, 56, 21, "$100.000", false, ventana) 
guiLabelSetVerticalAlign(preciohunter, "center") 
preciohydra = guiCreateLabel(106, 268, 56, 21, "$100.000", false, ventana) 
guiLabelSetVerticalAlign(preciohydra, "center") 
preciorhino = guiCreateLabel(292, 268, 57, 21, "$100.000", false, ventana) 
guiLabelSetVerticalAlign(preciorhino, "center") 
precioseas = guiCreateLabel(287, 240, 62, 18, "$100.000", false, ventana) 
guiLabelSetHorizontalAlign(precioseas, "center", false) 
guiLabelSetVerticalAlign(precioseas, "center") 
botonrhino = guiCreateButton(349, 271, 97, 18, "Rhino", false, ventana) 
botonseas = guiCreateButton(349, 240, 97, 18, "Seasparrow", false, ventana) 
imagen = guiCreateStaticImage(143, 98, 172, 99, ":Zombies/edf/zombiespawn.png", false, ventana) 
guiSetAlpha(imagen, 0.43) 
  
function OpenWin() 
    if guiGetVisible(ventana) then 
       guiSetVisible(ventana, false) 
       showCursor(false) 
    else 
        guiSetVisible(ventana, true) 
        showCursor(true) 
    end 
end 
bindKey("F7", "down", OpenWin) 

you have

bindKey("F7", "down", OpenWin) 

but it should be

bindKey('f7', 'down', toggleVentanaWindow) 

n-560x95_FFFFFF_FFFFFF_000000_000000.png
Posted
   
local screenW, screenH = guiGetScreenSize() 
ventana = guiCreateWindow((screenW - 456) / 2, (screenH - 307) / 2, 456, 307, ".-Tienda Zenbeit-.", false) 
guiWindowSetSizable(ventana, false) 
  
botonvida = guiCreateButton(9, 22, 97, 21, "Vida [100]", false, ventana) 
botonarmadura = guiCreateButton(9, 53, 97, 21, "Armadura [100]", false, ventana) 
botonminigun = guiCreateButton(349, 25, 97, 18, "Minigun [100]", false, ventana) 
botonbazooka = guiCreateButton(349, 56, 97, 18, "Bazooka [10]", false, ventana) 
guiLabelSetVerticalAlign(preciovida, "center") 
precioarmadura = guiCreateLabel(106, 53, 37, 21, "$400", false, ventana) 
guiLabelSetHorizontalAlign(precioarmadura, "center", false) 
guiLabelSetVerticalAlign(precioarmadura, "center") 
preciominigun = guiCreateLabel(297, 25, 47, 21, "$50.000", false, ventana) 
guiLabelSetVerticalAlign(preciominigun, "center") 
preciobazooka = guiCreateLabel(297, 56, 47, 18, "$50.000", false, ventana) 
guiLabelSetHorizontalAlign(preciobazooka, "center", false) 
guiLabelSetVerticalAlign(preciobazooka, "center") 
botonhunter = guiCreateButton(9, 237, 97, 21, "Hunter", false, ventana) 
botonhydra = guiCreateButton(9, 268, 97, 21, "Hydra", false, ventana) 
preciohunter = guiCreateLabel(106, 237, 56, 21, "$100.000", false, ventana) 
guiLabelSetVerticalAlign(preciohunter, "center") 
preciohydra = guiCreateLabel(106, 268, 56, 21, "$100.000", false, ventana) 
guiLabelSetVerticalAlign(preciohydra, "center") 
preciorhino = guiCreateLabel(292, 268, 57, 21, "$100.000", false, ventana) 
guiLabelSetVerticalAlign(preciorhino, "center") 
precioseas = guiCreateLabel(287, 240, 62, 18, "$100.000", false, ventana) 
guiLabelSetHorizontalAlign(precioseas, "center", false) 
guiLabelSetVerticalAlign(precioseas, "center") 
botonrhino = guiCreateButton(349, 271, 97, 18, "Rhino", false, ventana) 
botonseas = guiCreateButton(349, 240, 97, 18, "Seasparrow", false, ventana) 
imagen = guiCreateStaticImage(143, 98, 172, 99, ":Zombies/edf/zombiespawn.png", false, ventana) 
guiSetAlpha(imagen, 0.43) 
guiSetVisible(ventana, false) 
   
function OpenWin() 
    if (guiGetVisible(ventana) == false) then 
       guiSetVisible(ventana, true) 
       showCursor(true) 
    else 
        guiSetVisible(ventana, false) 
        showCursor(false) 
    end 
end 
bindKey("F7", "down", OpenWin)  
  

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...