Reputation: 1
I would like to place the hud in the top corner and on the right, and that there would be no problem with other resolutions
local circleScale, sizeStroke = 50, 3
local iconScale = 25
local circleLeft, circleTop = circleScale + 30, y - circleScale - 20
addEventHandler('onClientResourceStart', resourceRoot, function()
createCircle('bgHealth', circleScale, circleScale)
createCircle('bgArmor', circleScale, circleScale)
createCircleStroke('health', circleScale, circleScale, sizeStroke)
createCircleStroke('armor', circleScale, circleScale, sizeStroke)
hiddenComponents(false)
end)
addEventHandler('onClientResourceStop', resourceRoot, function()
hiddenComponents(true)
end)
addEventHandler('onClientRender', root, function()
drawItem('bgHealth', circleLeft, circleTop, tocolor(28, 28, 28, 170))
drawItem('bgArmor', circleLeft + circleScale + 10, circleTop, tocolor(28, 28, 28, 170))
drawItem('health', circleLeft, circleTop, tocolor(255, 255, 255))
dxDrawImage(circleLeft + ((circleScale/2) - (iconScale/2)), circleTop + ((circleScale/2) - (iconScale/2)), iconScale, iconScale, 'assets/health.png')
drawItem('armor', circleLeft + circleScale + 10, circleTop, tocolor(255, 255, 255))
dxDrawImage((circleLeft + circleScale + 10) + ((circleScale/2) - (iconScale/2)), circleTop + ((circleScale/2) - (iconScale/2)), iconScale, iconScale, 'assets/armor.png')
setSVGOffset('health', getElementHealth(localPlayer))
setSVGOffset('armor', getPedArmor(localPlayer))
end)
I tried changing the number (circleScale + 30 and circleScale - 20) to another value, but in another resolution it is completely out of line with expectations.
Upvotes: 0
Views: 32