MKZ213 Posted March 8, 2022 Share Posted March 8, 2022 eu criei meu hud so que a hud fica bugada quando eu saio da resoluçao 1280x720 porque quando eu vou pra resoluçao 640x480 a hud fica toda fora do lugar OBS:eu queria que a hud funciona-se em todas as resoluçoes em 1280x720 em 640x480 Link to comment
MKZ213 Posted March 9, 2022 Author Share Posted March 9, 2022 o script que eu fiz meta <meta> <info author="SkyCloud" description="Script feito por SkyCloud" version="0.0.1" type="script" /> <script src="dashscript.lua" type="client"/> <file src="fonts/montserrat-bold.ttf"/> </meta> dashscript local screenW, screenH = guiGetScreenSize() local abrirem = true local Font0001 = dxCreateFont ("fonts/montserrat-bold.ttf", 10) function renderdashboard() local playerName = getPlayerName(getLocalPlayer()) local id = getElementData(localPlayer, "ID") or "Sem ID" local lvl = getElementData(localPlayer,"Level") or "Sem Level" local emprego = getElementData (localPlayer,"Emprego") or "Desempregado" local bancol = getElementData(localPlayer, "banco") or 0 local maxplayer = 32 dxDrawRectangle(screenW * 0.8172, screenH * 0.2847, screenW * 0.1609, screenH * 0.3083, tocolor(26, 26, 26, 201), false) dxDrawRectangle(screenW * 0.8211, screenH * 0.4625, screenW * 0.1570, screenH * 0.0181, tocolor(11, 11, 11, 201), false) dxDrawRectangle(screenW * 0.8211, screenH * 0.4000, screenW * 0.1570, screenH * 0.0181, tocolor(11, 11, 11, 201), false) dxDrawRectangle(screenW * 0.8211, screenH * 0.3556, screenW * 0.1570, screenH * 0.0181, tocolor(11, 11, 11, 201), false) dxDrawRectangle(screenW * 0.8172, screenH * 0.2847, screenW * 0.1609, screenH * 0.0458, tocolor(0, 0, 0, 201), false) dxDrawText("Informações Pessoais", screenW * 1066, screenH * 210, screenW * 1235, screenH * 233, tocolor(255, 255, 255, 255), 0.70, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("Nome:", screenW * 0.8227, screenH * 0.3528, screenW * 0.8508, screenH * 0.3736, tocolor(255, 255, 255, 255), 1.00, Font0001, "left", "top", false, false, false, false, false) dxDrawText(playerName, screenW * 0.8586, screenH * 0.3528, screenW * 0.9781, screenH * 0.3736, tocolor(255, 255, 255, 255), 1.00, Font0001, "left", "top", false, false, false, false, false) dxDrawText("ID:", screenW * 0.8227, screenH * 0.4000, screenW * 0.8352, screenH * 0.4208, tocolor(255, 255, 255, 255), 1.00, Font0001, "left", "top", false, false, false, false, false) dxDrawText(id, screenW * 0.8430, screenH * 0.4000, screenW * 0.8758, screenH * 0.4208, tocolor(255, 255, 255, 255), 1.00, Font0001, "left", "top", false, false, false, false, false) dxDrawText("Level:", screenW * 0.8930, screenH * 0.4000, screenW * 0.9211, screenH * 0.4208, tocolor(255, 255, 255, 255), 1.00, Font0001, "left", "top", false, false, false, false, false) dxDrawText(lvl, screenW * 0.9258, screenH * 0.4000, screenW * 0.9586, screenH * 0.4208, tocolor(255, 255, 255, 255), 1.00, Font0001, "left", "top", false, false, false, false, false) dxDrawText("Trabalho:", screenW * 0.8211, screenH * 0.4597, screenW * 0.8602, screenH * 0.4819, tocolor(255, 255, 255, 255), 1.00, Font0001, "left", "top", false, false, false, false, false) dxDrawText(emprego, screenW * 0.8758, screenH * 0.4597, screenW * 0.9586, screenH * 0.4806, tocolor(255, 255, 255, 255), 1.00, Font0001, "left", "top", false, false, false, false, false) dxDrawRectangle(screenW * 0.8211, screenH * 0.5153, screenW * 0.1570, screenH * 0.0181, tocolor(11, 11, 11, 201), false) dxDrawText("Banco", screenW * 0.8211, screenH * 0.5139, screenW * 0.8523, screenH * 0.5319, tocolor(255, 255, 255, 255), 1.00, Font0001, "left", "top", false, false, false, false, false) dxDrawText(bancol, screenW * 0.8719, screenH * 0.5139, screenW * 0.9703, screenH * 0.5319, tocolor(255, 255, 255, 255), 1.00, Font0001, "left", "top", false, false, false, false, false) dxDrawText("R$:", screenW * 0.8523, screenH * 0.5139, screenW * 0.8695, screenH * 0.5333, tocolor(255, 255, 255, 255), 1.00, Font0001, "left", "top", false, false, false, false, false) dxDrawText("Online:", screenW * 0.8523, screenH * 0.5528, screenW * 0.8984, screenH * 0.5792, tocolor(255, 255, 255, 255), 1.50, "default", "left", "top", false, false, false, false, false) dxDrawText(#getElementsByType("player").."/"..maxplayer, screenW * 0.9016, screenH * 0.5528, screenW * 0.9477, screenH * 0.5792, tocolor(255, 255, 255, 255), 1.50, "default", "left", "top", false, false, false, false, false) end function abrir() if abrirem == false then removeEventHandler("onClientRender", getRootElement(), renderdashboard) abrirem = true else addEventHandler("onClientRender", getRootElement(), renderdashboard) abrirem = false end end bindKey( "tab", "both", abrir) Link to comment
Other Languages Moderators Lord Henry Posted March 9, 2022 Other Languages Moderators Share Posted March 9, 2022 Textos não são responsivos, portanto a escala não funciona neles. Ou você cria uma HUD com tamanho fixo ou então fique testando cada resolução e mudando o tamanho da fonte em cada uma. 1 Link to comment
MKZ213 Posted March 9, 2022 Author Share Posted March 9, 2022 mais eu nao sei fazer isso, voce tem alguma dica pra me dar Link to comment
Other Languages Moderators Lord Henry Posted March 11, 2022 Other Languages Moderators Share Posted March 11, 2022 local screen = Vector2 (guiGetScreenSize ()) -- Isso é igual a duas variáveis: screen.x, screen.y local resW, resH = 1280, 720 local x, y = (screen.x/resW), (screen.y/resH) -- Serve para fazer as posições dos DX serem responsivas. addEventHandler ("onClientRender", root, function () dxSetAspectRatioAdjustmentEnabled (true, 4/3) -- Corrige problemas de proporção. local size = screen.x/1280 -- Obtém o tamanho de acordo com a resolução X da tela. Resoluções maiores terão o size maior. dxDrawText("Teste Maroto", x*1095, y*40, x*1213, y*70, tocolor(255, 255, 255, 255), 0.9*size) -- Você pode mudar a posição, cor e também o valor antes do size para se adequar ao seu sistema. end) 1 Link to comment
MKZ213 Posted March 11, 2022 Author Share Posted March 11, 2022 Valeu mano me ajudou muito Link to comment
Recommended Posts