Jump to content

Painel DX


Recommended Posts

Como Faço Pra Em Vez De Clicar E Esperar Alguns Segundos E Mudar Para O Painel, Segurar Por 3 Segundos E Aparecer A Função

 

function closePanel(_,state)
    if isEventHandlerAdded("onClientRender", root, acessingUI) then
        if state == "down" then
            if isCursorOnElement(screenW * 0.4619, screenH * 0.5820, screenW * 0.0771, screenH * 0.1042) then 
                playSound("sfx/hit.mp3", false)
                setTimer( function()
                	removeEventHandler("onClientRender", root, acessingUI)
                	addEventHandler("onClientRender", root, caixaUI)
            	end, 3000, 1)
            end
        end
    end
end

 

Link to comment
1 hour ago, [N]inja said:

Como Faço Pra Em Vez De Clicar E Esperar Alguns Segundos E Mudar Para O Painel, Segurar Por 3 Segundos E Aparecer A Função

 


function closePanel(_,state)
    if isEventHandlerAdded("onClientRender", root, acessingUI) then
        if state == "down" then
            if isCursorOnElement(screenW * 0.4619, screenH * 0.5820, screenW * 0.0771, screenH * 0.1042) then 
                playSound("sfx/hit.mp3", false)
                setTimer( function()
                	removeEventHandler("onClientRender", root, acessingUI)
                	addEventHandler("onClientRender", root, caixaUI)
            	end, 3000, 1)
            end
        end
    end
end

 

alir em ' state == "down" ', coloque 'both' --> ' state == "down" '.

Na wiki fala sobre o evento: 'onClientClick'

  • Thanks 1
Link to comment

desculpe

 

function closePanel(_,state)
    if isEventHandlerAdded("onClientRender", root, acessingUI) then
        if state == "both" then
            if isCursorOnElement(screenW * 0.4619, screenH * 0.5820, screenW * 0.0771, screenH * 0.1042) then 
                playSound("sfx/hit.mp3", false)
                --setTimer( function()
                	removeEventHandler("onClientRender", root, acessingUI)
                	addEventHandler("onClientRender", root, caixaUI)
            	--end, 3000, 1)
            end
        end
    end

    if isEventHandlerAdded("onClientRender", root, caixaUI) then  
        if state == "down" then
            if isCursorOnElement(x*1068, y*94, x*36, y*38) then 
		        showCursor(false)
                showChat(true)
                setElementData(localPlayer, "Notification", false)
                setElementData(localPlayer, "Notification:S", false)
                playSound("sfx/hit.mp3", false)
                removeEventHandler("onClientRender", root, caixaUI)
            end
        end
    end

    if isEventHandlerAdded("onClientRender", root, transUI) then  
        if state == "down" then
            if isCursorOnElement(x*1068, y*94, x*36, y*38) then 
                showCursor(false)
                setElementData(localPlayer, "Notification", false)
                setElementData(localPlayer, "Notification:S", false)
                showChat(true)
                playSound("sfx/hit.mp3", false)
                grid:SetVisible(false)
                removeEventHandler("onClientRender", root, transUI)
                changeVisibility("1", false)
            end
        end
    end

    if isEventHandlerAdded("onClientRender", root, depositUI) then  
        if state == "down" then
            if isCursorOnElement(x*1068, y*94, x*36, y*38) then 
                showCursor(false)
                showChat(true)
                playSound("sfx/hit.mp3", false)
                setElementData(localPlayer, "Notification", false)
                setElementData(localPlayer, "Notification:S", false)
                changeVisibility("2", false)
                removeEventHandler("onClientRender", root, depositUI)
            end
        end
    end

    if isEventHandlerAdded("onClientRender", root, sacUI) then  
        if state == "down" then
            if isCursorOnElement(x*1068, y*94, x*36, y*38) then 
                showCursor(false)
                setElementData(localPlayer, "Notification", false)
                setElementData(localPlayer, "Notification:S", false)
                showChat(true)
                playSound("sfx/hit.mp3", false)
                removeEventHandler("onClientRender", root, sacUI)
                changeVisibility("3", false)
            end
        end
    end

    if isEventHandlerAdded("onClientRender", root, sacUI) then  
        if state == "down" then
            if isCursorOnElement(x*502, y*564, x*320, y*56) then 
                playSound("sfx/hit.mp3", false)
                removeEventHandler("onClientRender", root, sacUI)
                addEventHandler("onClientRender", root, caixaUI)
                changeVisibility("3", false)
            end
        end
    end
    if isEventHandlerAdded("onClientRender", root, depositUI) then  
        if state == "down" then
            if isCursorOnElement(x*502, y*564, x*320, y*56) then 
                playSound("sfx/hit.mp3", false)
                removeEventHandler("onClientRender", root, depositUI)
                addEventHandler("onClientRender", root, caixaUI)
                changeVisibility("2", false)
            end
        end
    end
end
addEventHandler("onClientClick", root, closePanel)

 

Link to comment
On 22/12/2020 at 22:37, [N]inja said:

n pegou colocando both

local pressing = false

bindKey("k", "both", function(_, state)
    if state == "down" then
        if not pressing then
            pressing = getTickCount()
        end
    elseif state == "up" then
        if pressing and pressing + 3000 >= getTickCount() then
            pressing = false
            outputChatBox("* Erro: você deve segurar por 3 segundos.", 255, 0, 0)
        else
            pressing = false
            -- executa a função que você quer
        end
    end
end)

pega este exemplo tente elaborar uma lógica.

  • Thanks 1
Link to comment
function onClick(button, state)
	if button == "left" then
		if state == "down" then
			tick = getTickCount()
		elseif state == "up" then
			if (getTickCount() - tick) >= 3000 then
				--PROSSIGA SEU SCRIPT AQUI
			else
				outputChatBox("Você precisa pressionar o botão por 3 segundos")
			end
		end
	end
end
addEventHandler("onClientClick", root, onClick)

 

  • Thanks 2
Link to comment
2 hours ago, ber said:

function onClick(button, state)
	if button == "left" then
		if state == "down" then
			tick = getTickCount()
		elseif state == "up" then
			if (getTickCount() - tick) >= 3000 then
				--PROSSIGA SEU SCRIPT AQUI
			else
				outputChatBox("Você precisa pressionar o botão por 3 segundos")
			end
		end
	end
end
addEventHandler("onClientClick", root, onClick)

 

isso, desta maneira !. Boa @ber

  • Thanks 1
Link to comment
  • 2 weeks later...

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