Hello! I started lua programming in MTA so, I got a problem, and I don't understand the other topics. Just send the code, and I will read it, and understand it. And if you can descript it pls do it.
How to optimize this code on every screen?
local x,y = guiGetScreenSize()
oX, oY = 1920, 1080
function mainRender()
local health, armor = getElementHealth(localPlayer), getPedArmor(localPlayer)
local h, m = getTime()
if h < 10 then h = "0" .. h end
if m < 10 then m = "0" .. m end
dxDrawRectangle(1590/oX*x, 30/oY*y, 300/oX*x, 100/oY*y 0x7F000000)
dxDrawRectangle(1600/oX*x, 40/oY*y, 280*healt/100/oX*x, 10/oY*y, tocolor(255, 0, 0))-- élet
dxDrawRectangle(1600/oX*x, 60/oY*y, 280*armor/100/oX*x, 10/lY*y, tocolor(0, 0, 255))-- pajzs
dxDrawText(h .. ":" .. m, 1600, 70, _, _, _, 2, "pricedown", "left", "top") --idő
end
addEventHandler("OnClientRender", root, mainrender)