local sx, sy = guiGetScreenSize()
local zoom = sx < 1920 and math.min(2, 1920 / sx) or 1
local fonts = {
[1] = dxCreateFont("font.ttf", 13/zoom),
[2] = dxCreateFont("font.ttf", 14/zoom),
[3] = dxCreateFont("extrabold.ttf", 16/zoom),
}
function renderHUD()
if not getElementData(localPlayer, "player:sid") or getElementData(localPlayer,"notshowhud") then
return
end
local hearth = getElementHealth(localPlayer)
local armor = getPlayerArmor(localPlayer)
--exports.visual-avatars:dxCreateAvatar(sx/2+829/zoom, sy/2-512/zoom, 92/zoom, 92/zoom)
dxDrawImage(sx/2+760/zoom, sy/2-511/zoom, 140/zoom, 140/zoom, "bgav.png", 0,0,0, tocolor(255, 255, 255,255))
dxDrawImage(sx/2+775/zoom, sy/2-498/zoom, 110/zoom, 110/zoom, "logo.png", 0,0,0, tocolor(255, 255, 255,255))
dxDrawImage(sx/2+505/zoom, sy/2-468/zoom, 250/zoom, 29/zoom, "sercelado.png", 0,0,0, tocolor(255, 255, 255,255))
dxDrawImage(sx/2+535/zoom, sy/2-501/zoom, 220/zoom, 29/zoom, "armorlado.png", 0,0,0, tocolor(255, 255, 255,255))
-- roundedRectangle(sx/2+770/zoom, sy/2-382/zoom, 120/zoom, 15/zoom, tocolor(55, 55, 55, 255))
dxDrawImageSection(sx/2+507/zoom, sy/2-466/zoom, 246/zoom*hearth/100, 25/zoom, 0, 0, 246,25,"ladowaniehearth.png",0,0,0,tocolor(255,255,255))
dxDrawImageSection(sx/2+537/zoom, sy/2-499/zoom, 217/zoom*armor/100, 25/zoom, 0, 0, 246,25,"ladowaniearmoru.png",0,0,0,tocolor(255,255,255))
--dxDrawImage(sx/2+575/zoom, sy/2-474/zoom, 18/zoom, 20/zoom, "armor.png", 0,0,0, tocolor(255, 255, 255,255))
--dxDrawImage(sx/2+575/zoom, sy/2-505/zoom, 18/zoom, 17/zoom, "hearth.png", 0,0,0, tocolor(255, 255, 255,255))
dxDrawImage(sx/2+543/zoom, sy/2-495/zoom, 14/zoom, 14/zoom, "armorek.png", 0,0,0, tocolor(255, 255, 255,255))
dxDrawImage(sx/2+514/zoom, sy/2-461/zoom, 14/zoom, 14/zoom, "serduszko.png", 0,0,0, tocolor(255, 255, 255,255))
dxDrawText(""..string.format("%02d", math.floor(hearth)).."%", sx/2+725/zoom, sy/2-463/zoom, nil, nil, tocolor(211, 211, 211, 255), 1, fonts[2], "center", "top", false, false, false, true)
dxDrawText(""..string.format("%02d", math.floor(armor)).."%", sx/2+725/zoom, sy/2-496/zoom, nil, nil, tocolor(211, 211, 211, 255), 1, fonts[2], "center", "top", false, false, false, true)
dxDrawText("#50d274$ #ffffff"..getPlayerMoney(localPlayer), sx/2+753/zoom, sy/2-442/zoom, nil, nil, tocolor(255, 255, 255, 255), 1, fonts[3], "right", "top", false, false, false, true)
dxDrawText(string.gsub(getPlayerName(localPlayer), "#%x%x%x%x%x%x", ""), sx/2+800/zoom, sy/2-375/zoom, nil, nil, tocolor(255, 255, 255, 211), 1, fonts[2], "left", "top", false, false, false, true)
end
function roundedRectangle(x, y, w, h, borderColor, bgColor, postGUI)
if (x and y and w and h) then
if (not borderColor) then
borderColor = tocolor(0, 0, 0, 200);
end
if (not bgColor) then
bgColor = borderColor;
end
dxDrawRectangle(x, y, w, h, bgColor, postGUI);
dxDrawRectangle(x + 2, y - 1, w - 4, 1, borderColor, postGUI);
dxDrawRectangle(x + 2, y + h, w - 4, 1, borderColor, postGUI);
dxDrawRectangle(x - 1, y + 2, 1, h - 4, borderColor, postGUI);
dxDrawRectangle(x + w, y + 2, 1, h - 4, borderColor, postGUI);
end
end
function createHUD()
removeEventHandler("onClientRender", root, renderHUD)
addEventHandler("onClientRender", root, renderHUD)
setPlayerHudComponentVisible("all", false)
setPlayerHudComponentVisible("radar", true)
setPlayerHudComponentVisible("crosshair", true)
end
function destroyHUD()
removeEventHandler("onClientRender", root, renderHUD)
end
setPlayerHudComponentVisible("radar", true)
createHUD()