Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function isCursorOnElement( posX, posY, width, height )
- if isCursorShowing( ) then
- local mouseX, mouseY = getCursorPosition( )
- local clientW, clientH = guiGetScreenSize( )
- local mouseX, mouseY = mouseX * clientW, mouseY * clientH
- if ( mouseX > posX and mouseX < ( posX + width ) and mouseY > posY and mouseY < ( posY + height ) ) then
- return true
- end
- end
- return false
- end
- function vazernButton(posX, posY, width, height, text, colorRec, cursorColor, colorText, font, scale, colorCoded, postGUI)
- dxDrawRectangle(x*posX, y*posY, x*width, y*height, colorRec, postGUI)
- dxDrawRectangle(x*posX, y*posY, x*width, y*height, isCursorOnElement(x*posX, y*posY, x*width, y*height) and colorRec or tocolor(0, 0, 0, 0), postGUI)
- dxDrawRectangle(x*posX, y*posY, x*width, y*height, isCursorOnElement(x*posX, y*posY, x*width, y*height) and cursorColor or tocolor(0, 0, 0, 0), postGUI)
- dxDrawRectangle(x*posX, y*posY + y*height - 4, x*width, y*height/10, isCursorOnElement(x*posX, y*posY, x*width, y*height) and tocolor(0, 0, 0, 80) or tocolor(0, 0, 0, 0), postGUI)
- dxDrawText(text, x*posX + x*posX, y*posY + y*posY, x*width, y*height, isCursorOnElement(x*posX, y*posY, x*width, y*height) and tocolor(255, 255, 255, 200) or colorText, x*scale, font, "center", "center", false, false, postGUI, colorCoded, false)
- end
- --[[
- ## Exemplo de como usar
- ]]
- addEventHandler("onClientRender", root,
- function()
- vazernButton(507, 525, 364, 51, "TESTAR MEU CONHECIMENTO", tocolor(0, 0, 0, 162), tocolor(145, 212, 17, 110), tocolor(255, 255, 255, 120), "default", 1.3, false, false)
- end
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement