Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.62 KB | None | 0 0
  1. function isCursorOnElement( posX, posY, width, height )
  2.   if isCursorShowing( ) then
  3.     local mouseX, mouseY = getCursorPosition( )
  4.     local clientW, clientH = guiGetScreenSize( )
  5.     local mouseX, mouseY = mouseX * clientW, mouseY * clientH
  6.     if ( mouseX > posX and mouseX < ( posX + width ) and mouseY > posY and mouseY < ( posY + height ) ) then
  7.       return true
  8.     end
  9.   end
  10.   return false
  11. end
  12.  
  13.  
  14. function vazernButton(posX, posY, width, height, text, colorRec, cursorColor, colorText, font, scale, colorCoded, postGUI)
  15.     dxDrawRectangle(x*posX, y*posY, x*width, y*height, colorRec, postGUI)
  16.     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)
  17.     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)
  18.     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)
  19.     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)
  20. end
  21.  
  22. --[[
  23.  
  24. ## Exemplo de como usar
  25.  
  26. ]]
  27.  
  28. addEventHandler("onClientRender", root,
  29.     function()
  30.        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)
  31.     end
  32. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement