Viictor_ Posted June 22, 2021 Share Posted June 22, 2021 i get problems when i use a different resolution,when i use 1366x768 its all alright but when i use 1024x768 or others the images and retangles just disappear screenW,screenH = guiGetScreenSize() local resW, resH = 1366,768 local x, y = (screenW/resW), (screenH/resH) local components = { "area_name", "radio", "vehicle_name" } function HudVictor ( ... ) if (not isPlayerMapVisible()) then local Dinheiro = getPlayerMoney(localPlayer) local Banco = getElementData(localPlayer, "Bank:Caixa") or "Não Sincronizado" local weapon = getPedWeapon(getLocalPlayer()) local weaponClip = getPedAmmoInClip(getLocalPlayer(), getPedWeaponSlot(getLocalPlayer())) local weaponAmmo = getPedTotalAmmo(getLocalPlayer()) - getPedAmmoInClip(getLocalPlayer()) local vida = math.floor(getElementHealth(getLocalPlayer())) local colete = math.floor(getPedArmor(getLocalPlayer())) local fome = getElementData(getLocalPlayer(), "hunger") or 50 local sede = getElementData(getLocalPlayer(), "sede") or 50 dxDrawImage(screenW * 0.6594, screenH * 0.0208, screenW * 0.3328, screenH * 0.1028, "hud/files/Icons/prehud.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.7727, screenH * 0.0208, screenW * 0.0547/100*vida, screenH * 0.1028, tocolor(255, 0, 0, 255), false) dxDrawRectangle(screenW * 0.8273, screenH * 0.0208, screenW * 0.0547/100*colete, screenH * 0.1028, tocolor(70, 130, 180, 255), false) dxDrawRectangle(screenW * 0.8820, screenH * 0.0208, screenW * 0.0547/100*fome, screenH * 0.1028, tocolor(244, 164, 96, 255), false) dxDrawLine((screenW * 0.9367) - 1, screenH * 0.1236, screenW * 0.9914, screenH * 0.1236, tocolor(70, 130, 180, 255), 1, false) dxDrawLine(screenW * 0.9914, screenH * 0.1236, screenW * 0.9914, (screenH * 0.0208) - 1, tocolor(70, 130, 180, 255), 1, false) dxDrawRectangle(screenW * 0.9367, screenH * 0.0208, screenW * 0.0547/100*sede, screenH * 0.1028, tocolor(145, 224, 230, 255), false) dxDrawText(""..Dinheiro, screenW * 0.6914, screenH * 0.0319, screenW * 0.7492, screenH * 0.0800, tocolor(255, 255, 255, 255), 1.00, "default-bold", "right", "center", false, false, false, false, false) dxDrawText(""..Banco, screenW * 0.6914, screenH * 0.0847, screenW * 0.7492, screenH * 0.1144, tocolor(255, 255, 255, 255), 1.00, "default-bold", "right", "center", false, false, false, false, false) dxDrawImage(screenW * 0.7727, screenH * 0.0222, screenW * 0.0547, screenH * 0.1014, "hud/files/Icons/health.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(screenW * 0.8266, screenH * 0.0222, screenW * 0.0555, screenH * 0.1014, "hud/files/Icons/bulletproof.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(screenW * 0.8820, screenH * 0.0208, screenW * 0.0547, screenH * 0.1028, "hud/files/Icons/hunger.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(1204, 18, 60, 61, "hud/files/Icons/water.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(1051, 98, 212, 113, "hud/files/Icons/Armas/"..weapon.. ".png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText(""..weaponClip.."/"..weaponAmmo.."", 1173, 141, 1249, 192, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false) end end --/100*fome function setHud() addEventHandler("onClientRender", getRootElement(), HudVictor) setPlayerHudComponentVisible("armour", false) setPlayerHudComponentVisible("wanted", false) setPlayerHudComponentVisible("weapon", false) setPlayerHudComponentVisible("money", false) setPlayerHudComponentVisible("health", false) setPlayerHudComponentVisible("clock", false) setPlayerHudComponentVisible("breath", false) setPlayerHudComponentVisible("ammo", false) for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), setHud) function removeHud() setPlayerHudComponentVisible("armour", true) setPlayerHudComponentVisible("wanted", true) setPlayerHudComponentVisible("weapon", true) setPlayerHudComponentVisible("money", true) setPlayerHudComponentVisible("health", true) setPlayerHudComponentVisible("clock", true) setPlayerHudComponentVisible("breath", true) setPlayerHudComponentVisible("ammo", true) end addEventHandler("onClientResourceStop", getResourceRootElement(getThisResource()), removeHud) Link to comment
βurak Posted June 22, 2021 Share Posted June 22, 2021 hi, have you tried multiplying the coordinates by x and y instead of multiplying by screenW and screenH? example: dxDrawRectangle(x * 0.7727, y * 0.0208, x * 0.0547/100*vida, y * 0.1028, tocolor(255, 0, 0, 255), false) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now