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)