magnux Posted December 5, 2020 Share Posted December 5, 2020 SEGUINTE RAPAZIADA QUERIA CLICK EM UMA BOTAO E FECHA OS OUTROS E ABRIR O QUE EU TAVA CLIKANDO EXEMPLO : CLICK NO SALA DAI FICA FECHADO REGREAS E INFOR, DAI CLICK EM REGREAS AI FECHA SALA E INFOR AJUDA PF . function SalasOn (_,state) if painellobby == true then if state == "down" then if isCursorOnElement (x*22, y*288, x*181, y*53) then addEventHandler ("onClientRender", root, salas) showCursor (true) painellobby = false painellobby2 = true painellobby3 = false painellobby4 = false end end end end addEventHandler ("onClientClick", root, SalasOn) function RegrasOn (_,state) if painellobby == true then if state == "down" then if isCursorOnElement (x*20, y*350, x*165, y*58) then addEventHandler ("onClientRender", root, regras) showCursor (true) painellobby = false painellobby2 = false painellobby3 = true painellobby4 = false end end end end addEventHandler ("onClientClick", root, RegrasOn) function InforOn (_,state) if painellobby == true then if state == "down" then if isCursorOnElement (x*25, y*418, x*242, y*56) then addEventHandler ("onClientRender", root, infor) showCursor (true) painellobby = false painellobby2 = false painellobby3 = false painellobby4 = true end end end end addEventHandler ("onClientClick", root, InforOn) Link to comment
Other Languages Moderators Lord Henry Posted December 7, 2020 Other Languages Moderators Share Posted December 7, 2020 Código ilegível. Favor indente seu código. 1 Link to comment
HiroShi Posted December 23, 2020 Share Posted December 23, 2020 On 05/12/2020 at 01:02, magnux said: SEGUINTE RAPAZIADA QUERIA CLICK EM UMA BOTAO E FECHA OS OUTROS E ABRIR O QUE EU TAVA CLIKANDO EXEMPLO : CLICK NO SALA DAI FICA FECHADO REGREAS E INFOR, DAI CLICK EM REGREAS AI FECHA SALA E INFOR AJUDA PF . function SalasOn (_,state) if painellobby == true then if state == "down" then if isCursorOnElement (x*22, y*288, x*181, y*53) then addEventHandler ("onClientRender", root, salas) showCursor (true) painellobby = false painellobby2 = true painellobby3 = false painellobby4 = false end end end end addEventHandler ("onClientClick", root, SalasOn) function RegrasOn (_,state) if painellobby == true then if state == "down" then if isCursorOnElement (x*20, y*350, x*165, y*58) then addEventHandler ("onClientRender", root, regras) showCursor (true) painellobby = false painellobby2 = false painellobby3 = true painellobby4 = false end end end end addEventHandler ("onClientClick", root, RegrasOn) function InforOn (_,state) if painellobby == true then if state == "down" then if isCursorOnElement (x*25, y*418, x*242, y*56) then addEventHandler ("onClientRender", root, infor) showCursor (true) painellobby = false painellobby2 = false painellobby3 = false painellobby4 = true end end end end addEventHandler ("onClientClick", root, InforOn) Esse código está com uma logíca muito mal elaborada, invés de vc criar 4 variaveis, você poderia criar apenas 1, e invés de 4 functions vc precisiraria criar apenas 1. Então vms lá, vou transformar somente em 1 variavel e 1 função. aba = 1 -- variavel que define as abas clickPostions = { -- cordenada de cada botão { }, --bote aqui o cordenada do botão 1. {22, 288, 181, 53}, {20, 350, 165, 58}, {25, 418, 242, 56}, } addEventHandler ("onClientClick", root, function(_, s) if (painellobby) == true and (s) == 'down' then for i,v in ipairs(clickPostions) do if isCursorOnElement (x*v[1], y*v[2], x*v[3], y*v[4]) then aba = i end end end end) lembrando que deverá fazer umas alteraçoes no seu onClientRender 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