[N]inja Posted December 22, 2020 Share Posted December 22, 2020 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
Administrators Tut Posted December 22, 2020 Administrators Share Posted December 22, 2020 Thread's moved to the Portuguese forum Link to comment
HiroShi Posted December 23, 2020 Share Posted December 23, 2020 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' 1 Link to comment
[N]inja Posted December 23, 2020 Author Share Posted December 23, 2020 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
[N]inja Posted December 23, 2020 Author Share Posted December 23, 2020 n pegou colocando both Link to comment
HiroShi Posted December 27, 2020 Share Posted December 27, 2020 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. 1 Link to comment
ber Posted December 27, 2020 Share Posted December 27, 2020 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) 2 Link to comment
HiroShi Posted December 27, 2020 Share Posted December 27, 2020 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 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now