How to optimize this HUD to every screen?

Recommended Posts

Posted (edited)

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ő

addEventHandler("OnClientRender", root, mainrender)







Edited by dobos90

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.