Jump to content

[AJUDA] Menu DX


Recommended Posts

Olá gostaria de saber como posso diminuir esses códigos pra não ficar tao grande no menu que estou criando

tocolorbut1 = tocolor(154,205,50, 220)
    if isCursorOnElement(screenW * 0.6020, screenH * 0.1550, screenW * 0.0600, screenH * 0.0300) then--botao1
        tocolorbut1 = tocolor(255,255,255, 20)	
    end
	tocolorbut2 = tocolor(154,205,50, 220)
	if isCursorOnElement(screenW * 0.6020, screenH * 0.2029, screenW * 0.0600, screenH * 0.0300) then--botao2
        tocolorbut2 = tocolor(255,255,255, 20)
	end
    tocolorbut3 = tocolor(154,205,50, 220)
	if isCursorOnElement(screenW * 0.6020, screenH * 0.2498, screenW * 0.0600, screenH * 0.0300) then--botao3
        tocolorbut3 = tocolor(255,255,255, 20)
	end

Tem mais pra baixo tipo uns 20 e o codigo fica muito grande .-.

Link to comment

tipo

cor1 = tocolor(154,205,50, 220)
cor2 = tocolor(255,255,255, 20)
	botao 1 = isCursorOnElement(screenW * 0.6020, screenH * 0.2029, screenW * 0.0600, screenH * 0.0300)
    botao 2 = isCursorOnElement(screenW * 0.6020, screenH * 0.2029, screenW * 0.0600, screenH * 0.0300)
    botao 3 = isCursorOnElement(screenW * 0.6020, screenH * 0.2029, screenW * 0.0600, screenH * 0.0300)

a cor1 padrao e quando passo o mouse por cima do botao 1 = ele muda pro cor2

 

Edited by LucasMTA
Link to comment

Acho que entendi. Isso deve te servir


function Dx ()
	dxDrawButton(x*379, y*300, x*608, y*53, "SIM", tocolor(255, 0, 0, 220), tocolor(255, 255, 255, 255), "default-bold", 1, false, false)
end

--==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-

function dxDrawButton(posX, posY, width, height, text, cursorColor, colorText, font, scale, colorCoded, postGUI)
    dxDrawRectangle(posX, posY, width, height, isCursorOnElement(posX, posY, width, height) and cursorColor or tocolor(0, 0, 0, 150), postGUI)
    dxDrawText(text, posX + posX, posY + posY -3, width, height, isCursorOnElement(posX, posY, width, height) and tocolor(255, 255, 255, 255) or colorText, scale, Font_4, "center", "center", false, false, postGUI, colorCoded, false)
end

--==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-

 

  • Thanks 1
Link to comment

entao no caso do meu painel quando eu clico no botao ele cria um blip no mapa 

como eu faço para esse blip sumir quando eu clico a segunda veiz no botao

 

function funcbotao1()
  if getElementType(source) == "player" then
      triggerClientEvent(source, "botao1", root)
      blipnaoaparece ()
      setElementVisibleTo ( blipbotao1, source, true )		  	
      outputChatBox ("#9ACD32[AGENCIA]: #FFFFFFVocê foi aceito no Emprego de .......", source, 255, 255, 255, true )
      outputChatBox ("#9ACD32[AGENCIA]: #FFFFFFPara iniciar os serviços siga o checkpoint vermelho em seu radar", source, 255, 255, 255, true )	  
  end
end  
addEvent("botao1",true)
addEventHandler("botao1", root, funcbotao1)

 

e oque significa esse erro 

HwaQyWD.png

Link to comment
  • Moderators

Ainda sobre a sua primeira pergunta, você pode organizar seu código e também encurtar com tabela, assim:

local buttonColor = {
    { default = tocolor(154,205,50, 220), mouseOver = tocolor(255,255,255, 20) } -- botão 1
    { default = tocolor(154,205,50, 220), mouseOver = tocolor(255,255,255, 20) } -- botão 2
    { default = tocolor(154,205,50, 220), mouseOver = tocolor(255,255,255, 20) } -- botão 3
}

function renderButton()
    local b1col = isCursorOnElement(screenW * 0.6020, screenH * 0.1550, screenW * 0.0600, screenH * 0.0300) and buttonColor[1].mouseOver or buttonColor[1].default
    local b2col = isCursorOnElement(screenW * 0.6020, screenH * 0.1550, screenW * 0.0600, screenH * 0.0300) and buttonColor[2].mouseOver or buttonColor[2].default
    local b3col = isCursorOnElement(screenW * 0.6020, screenH * 0.1550, screenW * 0.0600, screenH * 0.0300) and buttonColor[3].mouseOver or buttonColor[3].default

    dxDrawRectangle( x,y,w,h,b1col )
    dxDrawRectangle( x,y,w,h,b2col )
    dxDrawRectangle( x,y,w,h,b3col )
end

Sobre o blip, comece primeiro fazendo o correto no lado cliente, defina uma variável pra saber se foi o primeiro clique ou segundo, e adicione corretamente o evento no cliente com addEvent + addEventHandler assim como está no lado server; quando receber a chamada do server, desative a interface e/ou faça o que mais for necessário.

Link to comment

obrigado a todos que me ajudaram eu vou tentar arrumar os erros e melhorar o painel

ja na questao do blip eu vou deixar pra depois isso porque eu nao manjo muito e nao entendi direito , issso e porque eu nao sei muito msm como funciona mais tirando isso voceis sao fodas obrigado pela ajuda breve vo posta aqui o painel como ta ficando

Edited by LucasMTA
Link to comment

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