Jump to content

AJUDA COM PAINEL DX


Recommended Posts

oque posso estar fazendo pra quando um player colocar o mouse em cima de um botao dx ele mudar de cor?

ja tentei usar o isMouseInPosition mais sem sucesso, espero q me ajudem :c, sou novo em scripting 

queria saber também q funções posso estar utilizando pra quando eu abrir meu painel ele abrir com algum tipo de "animação"

obs: não tenho interesses em paineis GUI

obrigado 

Edited by bad skull
Link to comment

você pode usar a renderização do cliente e verificar se o mouse está na posição, para mudar de cor, aqui está um exemplo

local sX, sY = guiGetScreenSize()
local r, b, g, alpha = 0, 0, 0, 0
local visible = false
local state

function isMouseInPosition ( x, y, width, height )
	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

function draw()
if visible = true then
dxDrawRectangle(sX * 0.0154, sY * 0.3008, sX * 0.2284, sY * 0.3242, tocolor(r, b, g, alpha))
if isMouseInPosition(sX * 0.0154, sY * 0.3008, sX * 0.2284, sY * 0.3242) then r,b,g = 255,0,0 else r,b,g = 0,0,0 end
end
end

function fadeIN_FadeOut()
if state == 'increase' then
if alpha < 1 then
alpha = alpha + 5 end
if alpha > 254 then
removeEventHandler('onClientRender',fadeIN_FadeOut) end
elseif state == 'decrease' then
if alpha > 254 then
alpha = alpha - 5 end
if alpha < 1 then
removeEventHandler('onClientRender',fadeIN_FadeOut) end
end
end

bindKey('F2','down',
  function()
    if visible == false then
      visible = true
      addEventHandler("onClientRender", root, draw)
      addEventHandler("onClientRender", root, fadeIN_FadeOut)
	  state = 'increase'
      else
      visible = false
      removeEventHandler("onClientRender", root, draw)
	  addEventHandler("onClientRender", root, fadeIN_FadeOut)
	  state == 'decrease'
      end
    end)

 

  • Like 1
Link to comment
    dxDrawRectangle(screenW * 0.5514, screenH * 0.5022, screenW * 0.1319, screenH * 0.0522, COLOR, false)
    COLOR = tocolor(0, 0, 0, 150)
    if isCursorOnElement (screenW * 0.5514, screenH * 0.5022, screenW * 0.1319, screenH * 0.0522) then
	COLOR = tocolor(30, 144, 255, 150)
	end

O COLOR você coloca no lugar do tocolor(xxx, xxx, xxx, xxx)

  • Thanks 1
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...