Jump to content

[AJUDA]Tem como deixar meu painel dx em modo rainbow? tipo trocando de cor sozin


Recommended Posts

Quero deixar meu painel dx em modo rainbow ou fazer tipo uma opcao pra ficar trocando de cor tipo aqueles teclado da razer tlg

Meu DX (Tem mais de 1 aba)

function PainelKing ()
	if aba == "aba1" then
        dxDrawLine((screenW * 0.7839) - 1, (screenH * 0.2944) - 1, (screenW * 0.7839) - 1, screenH * 0.9704, tocolor(255, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9589, (screenH * 0.2944) - 1, (screenW * 0.7839) - 1, (screenH * 0.2944) - 1, tocolor(255, 0, 0, 255), 1, false)
        dxDrawLine((screenW * 0.7839) - 1, screenH * 0.9704, screenW * 0.9589, screenH * 0.9704, tocolor(255, 0, 0, 255), 1, false)
        dxDrawLine(screenW * 0.9589, screenH * 0.9704, screenW * 0.9589, (screenH * 0.2944) - 1, tocolor(255, 0, 0, 255), 1, false)
        dxDrawRectangle(screenW * 0.7839, screenH * 0.2944, screenW * 0.1750, screenH * 0.6759, tocolor(0, 0, 0, 202), false)
        dxDrawRectangle(screenW * 0.7839, screenH * 0.2944, screenW * 0.1750, screenH * 0.0130, tocolor(1, 0, 0, 254), false)
        dxDrawRectangle(screenW * 0.7839, screenH * 0.3074, screenW * 0.1750, screenH * 0.0083, tocolor(231, 0, 0, 254), false)
        dxDrawText("TROPA DO JURAMENTO", screenW * 0.7839, screenH * 0.2935, screenW * 0.9589, screenH * 0.3046, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
        dxDrawImage(screenW * 0.7891, screenH * 0.2954, screenW * 0.0083, screenH * 0.0102, ":admin/client/images/flags/br.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawImage(screenW * 0.9453, screenH * 0.2954, screenW * 0.0083, screenH * 0.0102, ":admin/client/images/flags/br.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawLine((screenW * 0.8073) - 1, (screenH * 0.3250) - 1, (screenW * 0.8073) - 1, screenH * 0.3833, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine(screenW * 0.9396, (screenH * 0.3250) - 1, (screenW * 0.8073) - 1, (screenH * 0.3250) - 1, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine((screenW * 0.8073) - 1, screenH * 0.3833, screenW * 0.9396, screenH * 0.3833, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine(screenW * 0.9396, screenH * 0.3833, screenW * 0.9396, (screenH * 0.3250) - 1, tocolor(255, 254, 254, 254), 1, false)
        dxDrawRectangle(screenW * 0.8073, screenH * 0.3250, screenW * 0.1323, screenH * 0.0583, tocolor(255, 0, 0, 254), false)
        dxDrawLine((screenW * 0.8073) - 1, (screenH * 0.3991) - 1, (screenW * 0.8073) - 1, screenH * 0.4574, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine(screenW * 0.9396, (screenH * 0.3991) - 1, (screenW * 0.8073) - 1, (screenH * 0.3991) - 1, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine((screenW * 0.8073) - 1, screenH * 0.4574, screenW * 0.9396, screenH * 0.4574, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine(screenW * 0.9396, screenH * 0.4574, screenW * 0.9396, (screenH * 0.3991) - 1, tocolor(255, 254, 254, 254), 1, false)
        dxDrawRectangle(screenW * 0.8073, screenH * 0.3991, screenW * 0.1323, screenH * 0.0583, tocolor(135, 0, 0, 254), false)
        dxDrawLine((screenW * 0.8073) - 1, (screenH * 0.4778) - 1, (screenW * 0.8073) - 1, screenH * 0.5361, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine(screenW * 0.9396, (screenH * 0.4778) - 1, (screenW * 0.8073) - 1, (screenH * 0.4778) - 1, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine((screenW * 0.8073) - 1, screenH * 0.5361, screenW * 0.9396, screenH * 0.5361, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine(screenW * 0.9396, screenH * 0.5361, screenW * 0.9396, (screenH * 0.4778) - 1, tocolor(255, 254, 254, 254), 1, false)
        dxDrawRectangle(screenW * 0.8073, screenH * 0.4778, screenW * 0.1323, screenH * 0.0583, tocolor(135, 0, 0, 254), false)
        dxDrawLine((screenW * 0.8073) - 1, (screenH * 0.5546) - 1, (screenW * 0.8073) - 1, screenH * 0.6130, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine(screenW * 0.9396, (screenH * 0.5546) - 1, (screenW * 0.8073) - 1, (screenH * 0.5546) - 1, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine((screenW * 0.8073) - 1, screenH * 0.6130, screenW * 0.9396, screenH * 0.6130, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine(screenW * 0.9396, screenH * 0.6130, screenW * 0.9396, (screenH * 0.5546) - 1, tocolor(255, 254, 254, 254), 1, false)
        dxDrawRectangle(screenW * 0.8073, screenH * 0.5546, screenW * 0.1323, screenH * 0.0583, tocolor(135, 0, 0, 254), false)
        dxDrawLine((screenW * 0.8073) - 1, (screenH * 0.6315) - 1, (screenW * 0.8073) - 1, screenH * 0.6898, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine(screenW * 0.9396, (screenH * 0.6315) - 1, (screenW * 0.8073) - 1, (screenH * 0.6315) - 1, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine((screenW * 0.8073) - 1, screenH * 0.6898, screenW * 0.9396, screenH * 0.6898, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine(screenW * 0.9396, screenH * 0.6898, screenW * 0.9396, (screenH * 0.6315) - 1, tocolor(255, 254, 254, 254), 1, false)
        dxDrawRectangle(screenW * 0.8073, screenH * 0.6315, screenW * 0.1323, screenH * 0.0583, tocolor(135, 0, 0, 254), false)
        dxDrawLine((screenW * 0.8073) - 1, (screenH * 0.7120) - 1, (screenW * 0.8073) - 1, screenH * 0.7704, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine(screenW * 0.9396, (screenH * 0.7120) - 1, (screenW * 0.8073) - 1, (screenH * 0.7120) - 1, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine((screenW * 0.8073) - 1, screenH * 0.7704, screenW * 0.9396, screenH * 0.7704, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine(screenW * 0.9396, screenH * 0.7704, screenW * 0.9396, (screenH * 0.7120) - 1, tocolor(255, 254, 254, 254), 1, false)
        dxDrawRectangle(screenW * 0.8073, screenH * 0.7120, screenW * 0.1323, screenH * 0.0583, tocolor(135, 0, 0, 254), false)
        dxDrawLine((screenW * 0.8073) - 1, (screenH * 0.7963) - 1, (screenW * 0.8073) - 1, screenH * 0.8546, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine(screenW * 0.9396, (screenH * 0.7963) - 1, (screenW * 0.8073) - 1, (screenH * 0.7963) - 1, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine((screenW * 0.8073) - 1, screenH * 0.8546, screenW * 0.9396, screenH * 0.8546, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine(screenW * 0.9396, screenH * 0.8546, screenW * 0.9396, (screenH * 0.7963) - 1, tocolor(255, 254, 254, 254), 1, false)
        dxDrawRectangle(screenW * 0.8073, screenH * 0.7963, screenW * 0.1323, screenH * 0.0583, tocolor(135, 0, 0, 254), false)
        dxDrawLine((screenW * 0.8073) - 1, (screenH * 0.8750) - 1, (screenW * 0.8073) - 1, screenH * 0.9333, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine(screenW * 0.9396, (screenH * 0.8750) - 1, (screenW * 0.8073) - 1, (screenH * 0.8750) - 1, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine((screenW * 0.8073) - 1, screenH * 0.9333, screenW * 0.9396, screenH * 0.9333, tocolor(255, 254, 254, 254), 1, false)
        dxDrawLine(screenW * 0.9396, screenH * 0.9333, screenW * 0.9396, (screenH * 0.8750) - 1, tocolor(255, 254, 254, 254), 1, false)
        dxDrawRectangle(screenW * 0.8073, screenH * 0.8750, screenW * 0.1323, screenH * 0.0583, tocolor(135, 0, 0, 254), false)
        dxDrawRectangle(screenW * 0.7839, screenH * 0.9611, screenW * 0.1750, screenH * 0.0083, tocolor(231, 0, 0, 254), false)
        dxDrawRectangle(screenW * 0.7839, screenH * 0.9481, screenW * 0.1750, screenH * 0.0130, tocolor(1, 0, 0, 254), false)
        dxDrawText("By-King021", screenW * 0.7839, screenH * 0.9491, screenW * 0.9589, screenH * 0.9602, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
        dxDrawText("Player", screenW * 0.8089, screenH * 0.3278, screenW * 0.9370, screenH * 0.3787, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Armas", screenW * 0.8073, screenH * 0.4028, screenW * 0.9354, screenH * 0.4537, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Veiculos", screenW * 0.8094, screenH * 0.4815, screenW * 0.9375, screenH * 0.5324, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Teleporte", screenW * 0.8094, screenH * 0.5583, screenW * 0.9375, screenH * 0.6093, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("God Mod", screenW * 0.8094, screenH * 0.6352, screenW * 0.9375, screenH * 0.6861, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Virar admin", screenW * 0.8094, screenH * 0.7157, screenW * 0.9375, screenH * 0.7667, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Anuncio", screenW * 0.8094, screenH * 0.8000, screenW * 0.9375, screenH * 0.8509, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false)
        dxDrawText("Explodir todos os veiculos", screenW * 0.8094, screenH * 0.8787, screenW * 0.9375, screenH * 0.9296, tocolor(255, 255, 255, 255), 0.80, "pricedown", "center", "center", false, false, false, false, false)

 

Link to comment
  • Other Languages Moderators

Um painel assim seria bem horrível em design e com certeza iria incomodar o usuário.

Mas se quer fazer mesmo assim, você pode simplesmente trocar todos os tocolor (...) por uma variável. Dai vc apenas tem que ficar mudando essa variável para alterar a cor do painel inteiro.

  • Thanks 1
Link to comment
20 hours ago, Lord Henry said:

Um painel assim seria bem horrível em design e com certeza iria incomodar o usuário.

Mas se quer fazer mesmo assim, você pode simplesmente trocar todos os tocolor (...) por uma variável. Dai vc apenas tem que ficar mudando essa variável para alterar a cor do painel inteiro.

é eu acabei percebendo quando fui tentar fazer,agora tipo quero fazer pra quando eu passar o mouse por cima dos botao ficar branco sabe? os botao seria o dxDrawnRectangle, Tbm queria saber como faço pra quando eu clicar na funçao ela trocar de cor exemplo MODO DEUS OFF ai quando clicar fica verde e MODO  DEUS ON

Link to comment
  • Other Languages Moderators

Só criar uma condição junto do dxDraw. Se o mouse estiver em cima do elemento, cria ele com tal cor, caso contrário cria com outra.

Você vai precisar da função útil isMouseInPosition

Exemplo maroto:

local sX, sY = guiGetScreenSize() -- Obtém a resolução do jogador.
showCursor (true) -- Mostra o cursor na tela.

function isMouseInPosition ( x, y, width, height ) -- Código-fonte da função útil. Obs: Não funciona para textos, use a versão alternativa para isso.
	if ( not isCursorShowing( ) ) then
		return false
	end
	local sx, sy = guiGetScreenSize ( )
	local cx, cy = getCursorPosition ( )
	local cx, cy = ( cx * sx ), ( cy * sy )
	
	return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) )
end

addEventHandler ("onClientRender", root, function () -- Executa essa função a cada frame, para manter o retângulo visível.
    if (isMouseInPosition (sX/2, sY/2, 100, 50)) then -- Coloca os mesmos parâmetros usados para criar o DX.
        dxDrawRectangle (sX/2, sY/2, 100, 50, 0xFFFFFFFF) -- Se o mouse está em cima da área do retângulo, então cria ele na cor branca.
    else -- Se o mouse não está em cima do retângulo, então:
        dxDrawRectangle (sX/2, sY/2, 100, 50, 0xFF808080) -- Cria ele em cinza.
    end
end)

Outra forma que dá pra fazer, mais compacta é você declarar a condição dentro do próprio parâmetro de cor.

addEventHandler ("onClientRender", root, function () -- Executa essa função a cada frame, para manter o retângulo visível.
    dxDrawRectangle (sX/2, sY/2, 100, 50, (isMouseInPosition (sX/2, sY/2, 100, 50) and 0xFFFFFFFF) or 0xFF808080) -- Se o mouse está em cima da área do retângulo, então cria ele na cor branca, caso contrário cria na cor cinza.
end)

 

Edited by Lord Henry
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...