bad skull Posted June 21, 2020 Share Posted June 21, 2020 (edited) 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 June 21, 2020 by bad skull Link to comment
MrKAREEM Posted June 21, 2020 Share Posted June 21, 2020 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) 1 Link to comment
ber Posted June 22, 2020 Share Posted June 22, 2020 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) 1 Link to comment
bad skull Posted June 22, 2020 Author Share Posted June 22, 2020 esse exemplo ai foi bem mais simples e funcional, vlw amigo 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