Guest User

Untitled

a guest
Jul 28th, 2017
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.69 KB | None | 0 0
  1.  
  2. function dxDrawRoundedRectangle(x, y, w, h, borderColor, bgColor, postGUI)
  3.     if (x and y and w and h) then
  4.         if (not borderColor) then
  5.             borderColor = tocolor(0, 0, 0, 200);
  6.         end
  7.        
  8.         if (not bgColor) then
  9.             bgColor = borderColor;
  10.         end
  11.        
  12.         --> Background
  13.         dxDrawRectangle(x, y, w, h, bgColor, postGUI);
  14.        
  15.         --> Border
  16.         dxDrawRectangle(x + 2, y - 1, w - 4, 1, borderColor, postGUI); -- top
  17.         dxDrawRectangle(x + 2, y + h, w - 4, 1, borderColor, postGUI); -- bottom
  18.         dxDrawRectangle(x - 1, y + 2, 1, h - 4, borderColor, postGUI); -- left
  19.         dxDrawRectangle(x + w, y + 2, 1, h - 4, borderColor, postGUI); -- right
  20.     end
  21. end
  22.  
  23. setElementData(localPlayer, "showHUD", true)
  24. setElementData(localPlayer, "kaja", 100)
  25. setElementData(localPlayer, "pia", 100)
  26. setElementData(localPlayer, "alvas", 100)
  27.  
  28.    
  29.  
  30.  
  31. function renderHud()
  32.     if not getElementData(localPlayer, "showHUD") then
  33.         return
  34.     end
  35.     local hp = getElementHealth(localPlayer)
  36.     local kaja = getElementData(localPlayer, "kaja")
  37.     local pia = getElementData(localPlayer, "pia")
  38.     local alvas = getElementData(localPlayer, "alvas")
  39.  
  40.     dxDrawImage ( sx - 312 - 180, -90, 700, 370, 'hud.png') -- Háttér
  41.  
  42.     dxDrawRoundedRectangle(sx - 312 - 34, 42, hp/5*15.3, 10, tocolor(210,34,72, 150)) -- HP
  43.  
  44.     dxDrawRoundedRectangle(sx - 312 - 34, 70, alvas/5*15.3, 10, tocolor(210,34,72, 150)) -- sleep
  45.  
  46.     dxDrawRoundedRectangle(sx - 312 - 34, 98, kaja/5*15.3, 10, tocolor(210,34,72, 150)) -- Kaja
  47.  
  48.     dxDrawRoundedRectangle(sx - 312 - 34, 126, pia/5*15.3, 10, tocolor(210,34,72, 150)) -- Pia
  49. end
  50. addEventHandler("onClientRender", root, renderHud)
Advertisement
Add Comment
Please, Sign In to add comment