Jump to content

DUDA : BLOQUEAR BOTONES DE UNA GUI


DeathMta

Recommended Posts

BUENAS ANDO CREANDO UNA GUI DE UN PANEL Y QUIERO QUE UN BOTON SE ELIMINE POR 4 MINUTOS Y VUELVA A APARECER

trato de integrar esto a mi boton

function guiFade( gui, state ) 
    if state == "in" then -- This state will fade IN the GUI 
    fadeIn = setTimer(guiFade, 50, 1, gui, state) -- We loop the function to make it lower the alpha each 50 ms 
    alpha = guiGetAlpha(gui) -- We get the GUI's actual alpha after each loop 
    guiSetAlpha(gui, alpha - 0.1) -- We set the GUI's actual alpha after each loop 
    if alpha == 0 then -- If the loop reached "0"... 
        guiSetVisible(gui, false) -- We set the GUI visibility to 0 so it won't be clickable or editable 
        killTimer(fadeIn) -- ... We kill the timer 
        fadeIn = nil -- And to make sure it doesn't exist anymore, we set it to nil 
        end 
    elseif state == "out" then -- This state will fade OUT the GUI 
        guiSetVisible(gui, true) -- Since the GUI will still be click-able, we'll set it's visibility to "false" 
        fadeOut = setTimer(guiFade, 50, 1, gui, state) -- We loop the function to make it higher the alpha each 50 ms 
        alpha = guiGetAlpha(gui) -- We get the GUI's actual alpha after each loop 
        guiSetAlpha(gui, alpha + 0.1) -- We set the GUI's actual alpha after each loop 
        if alpha == 1 then -- If the loop reached "1"... 
            killTimer(fadeOut) -- ... We kill the timer 
            fadeOut = nil -- And to make sure it doesn't exist anymore, we set it to nil 
        end 
    end 
end 
  

a este boton :

function FuncionMuniciones () 
showCursor (true) 
playSound("sonidos/sonidobronce.wav") 
triggerServerEvent ( "CuandoCliqueaMuniciones", getLocalPlayer()) 
  
end 

Link to comment
BUENAS ANDO CREANDO UNA GUI DE UN PANEL Y QUIERO QUE UN BOTON SE ELIMINE POR 4 MINUTOS Y VUELVA A APARECER

trato de integrar esto a mi boton

function guiFade( gui, state ) 
    if state == "in" then -- This state will fade IN the GUI 
    fadeIn = setTimer(guiFade, 50, 1, gui, state) -- We loop the function to make it lower the alpha each 50 ms 
    alpha = guiGetAlpha(gui) -- We get the GUI's actual alpha after each loop 
    guiSetAlpha(gui, alpha - 0.1) -- We set the GUI's actual alpha after each loop 
    if alpha == 0 then -- If the loop reached "0"... 
        guiSetVisible(gui, false) -- We set the GUI visibility to 0 so it won't be clickable or editable 
        killTimer(fadeIn) -- ... We kill the timer 
        fadeIn = nil -- And to make sure it doesn't exist anymore, we set it to nil 
        end 
    elseif state == "out" then -- This state will fade OUT the GUI 
        guiSetVisible(gui, true) -- Since the GUI will still be click-able, we'll set it's visibility to "false" 
        fadeOut = setTimer(guiFade, 50, 1, gui, state) -- We loop the function to make it higher the alpha each 50 ms 
        alpha = guiGetAlpha(gui) -- We get the GUI's actual alpha after each loop 
        guiSetAlpha(gui, alpha + 0.1) -- We set the GUI's actual alpha after each loop 
        if alpha == 1 then -- If the loop reached "1"... 
            killTimer(fadeOut) -- ... We kill the timer 
            fadeOut = nil -- And to make sure it doesn't exist anymore, we set it to nil 
        end 
    end 
end 
  

a este boton :

function FuncionMuniciones () 
showCursor (true) 
playSound("sonidos/sonidobronce.wav") 
triggerServerEvent ( "CuandoCliqueaMuniciones", getLocalPlayer()) 
  
end 

La función perfecta para lo que quieres es: guiSetEnabled

Link to comment

Creo que asi seria no he probado lol.

  
timesito = 4 
totals = timesito * 60000 
function FuncionMuniciones () 
showCursor (true) 
playSound("sonidos/sonidobronce.wav") 
triggerServerEvent ( "CuandoCliqueaMuniciones", getLocalPlayer()) 
guiSetEnabled(boton, false) 
setTimer(function() guiSetEnabled(boton, true) end, totals, 1 ) 
end 

Link to comment

osea mas claro :

uno usuario "x" abre un panel "x",

al presionar un boton , se destruya y pase un tiempo y se cree de nuevo el boton.

use el guisetenable , pero lo bloquea cuando el panel esta abierto , y al usar un settimer con el guisetenable , cuenta el tiempo cuando el panel esta abierto mas no cerrado no se si me dejo entender

Link to comment
function guiFade( gui, state ) 
    if state == "in" then -- This state will fade IN the GUI 
    fadeIn = setTimer(guiFade, 50, 1, gui, state) -- We loop the function to make it lower the alpha each 50 ms 
    alpha = guiGetAlpha(gui) -- We get the GUI's actual alpha after each loop 
    guiSetAlpha(gui, alpha - 0.1) -- We set the GUI's actual alpha after each loop 
    if alpha == 0 then -- If the loop reached "0"... 
        guiSetVisible(gui, false) -- We set the GUI visibility to 0 so it won't be clickable or editable 
        killTimer(fadeIn) -- ... We kill the timer 
        fadeIn = nil -- And to make sure it doesn't exist anymore, we set it to nil 
        end 
    elseif state == "out" then -- This state will fade OUT the GUI 
        guiSetVisible(gui, true) -- Since the GUI will still be click-able, we'll set it's visibility to "false" 
        fadeOut = setTimer(guiFade, 50, 1, gui, state) -- We loop the function to make it higher the alpha each 50 ms 
        alpha = guiGetAlpha(gui) -- We get the GUI's actual alpha after each loop 
        guiSetAlpha(gui, alpha + 0.1) -- We set the GUI's actual alpha after each loop 
        if alpha == 1 then -- If the loop reached "1"... 
            killTimer(fadeOut) -- ... We kill the timer 
            fadeOut = nil -- And to make sure it doesn't exist anymore, we set it to nil 
        end 
    end 
end 

trato de integrar esa funcion a mi boton ya que en la wiki mta

https://wiki.multitheftauto.com/wiki/GuiGetAlpha ese es el link

esa funcion dice que a un boton "x" lo destruye por un determinado tiempo

Link to comment

Prueba esto, si mal no entendi el problema es que al cerrar el panel se recrea el boton al 100%, la cosa es, que debes usar guiSetVisible(element, false) para la ventana, y no destroyElement(element) [en este caso]

function guiFade( gui, state ) 
    if not isElement(gui) then error("'gui' is not an element") return end 
    if state == "in" then -- This state will fade IN the GUI 
    fadeIn = setTimer(guiFade, 50, 1, gui, state) -- We loop the function to make it lower the alpha each 50 ms 
    alpha = guiGetAlpha(gui) -- We get the GUI's actual alpha after each loop 
    guiSetAlpha(gui, alpha - 0.1) -- We set the GUI's actual alpha after each loop 
    if alpha == 0 then -- If the loop reached "0"... 
        guiSetVisible(gui, false) -- We set the GUI visibility to 0 so it won't be clickable or editable 
        killTimer(fadeIn) -- ... We kill the timer 
        fadeIn = nil -- And to make sure it doesn't exist anymore, we set it to nil 
        end 
    elseif state == "out" then -- This state will fade OUT the GUI 
        guiSetVisible(gui, true) -- Since the GUI will still be click-able, we'll set it's visibility to "false" 
        guiSetEnabled(gui, false) 
        fadeOut = setTimer(guiFade, 50, 1, gui, state) -- We loop the function to make it higher the alpha each 50 ms 
        alpha = guiGetAlpha(gui) -- We get the GUI's actual alpha after each loop 
        guiSetAlpha(gui, alpha + 0.1) -- We set the GUI's actual alpha after each loop 
        if alpha == 1 then -- If the loop reached "1"... 
            killTimer(fadeOut) -- ... We kill the timer 
            guiSetEnabled(gui, true) 
            fadeOut = nil -- And to make sure it doesn't exist anymore, we set it to nil 
        end 
    end 
end 

Link to comment
  • Recently Browsing   0 members

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