Eficiencia Posted May 5, 2019 Share Posted May 5, 2019 (edited) oi, sou novo na area de programaçao em .lua e fazer paineis dx. bom resolvi fazer uma hud, o mta reconhece o script mas a hud na aparece quando executo o mesmo. codigo: local screenW, screenH = guiGetScreenSize() function hud () local vida = getElementHealth ( localPlayer ) local colete = getPedArmor ( localPlayer ) local muniçao = getPedAmmoInClip ( localPlayer ) local total = getPedTotalAmmo ( localPlayer ) local Oxigenio = getPedOxygenLevel ( localPlayer ) local dinheiro = getPlayerMoney ( localPlayer ) local arma = gerPedWeapon ( localPlayer ) local vidaatual = (screenW * 0.0889) * (vida/100) local coleteatual = (screenW * 0.0889) * (colete/100) dxDrawRectangle(screenW * 0.7148, screenH * 0.0000, screenW * 0.2852, screenH * 0.0859, tocolor(0, 0, 0, 193), false) dxDrawImage(screenW * 0.7246, screenH * 0.0195, screenW * 0.0381, screenH * 0.0430, ":Hud/img/22.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.7686, screenH * 0.0273, screenW * 0.0889, screenH * 0.0273, tocolor(173, 0, 0, 126), false) dxDrawRectangle(screenW * 0.7686, screenH * 0.0273, vidaatual, screenH * 0.0273, tocolor(173, 0, 0, 254), false) dxDrawImage(screenW * 0.8633, screenH * 0.0143, screenW * 0.0342, screenH * 0.0456, ":Hud/img/27.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.9014, screenH * 0.0273, screenW * 0.0889, screenH * 0.0273, tocolor(116, 116, 116, 141), false) dxDrawRectangle(screenW * 0.9014, screenH * 0.0273, coleteatual, screenH * 0.0273, tocolor(116, 116, 116, 254), false) dxDrawImage(screenW * 0.7207, screenH * 0.0859, screenW * 0.0576, screenH * 0.0716, ":Hud/armas/"..arma..".png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("1|0", (screenW * 0.7246) - 1, (screenH * 0.1589) - 1, (screenW * 0.7725) - 1, (screenH * 0.1797) - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("1|0", (screenW * 0.7246) + 1, (screenH * 0.1589) - 1, (screenW * 0.7725) + 1, (screenH * 0.1797) - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("1|0", (screenW * 0.7246) - 1, (screenH * 0.1589) + 1, (screenW * 0.7725) - 1, (screenH * 0.1797) + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("1|0", (screenW * 0.7246) + 1, (screenH * 0.1589) + 1, (screenW * 0.7725) + 1, (screenH * 0.1797) + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("1|0", screenW * 0.7246, screenH * 0.1589, screenW * 0.7725, screenH * 0.1797, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.7832, screenH * 0.0924, screenW * 0.2070, screenH * 0.0534, tocolor(1, 1, 1, 197), false) dxDrawImage(807, 76, 30, 26, ":Hud/img/10.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.8271, screenH * 0.1120, screenW * 0.0605, screenH * 0.0143, tocolor(129, 130, 0, 197), false) dxDrawRectangle(screenW * 0.8271, screenH * 0.1120, screenW * 0.0605, screenH * 0.0143, tocolor(233, 235, 0, 254), false) dxDrawImage(914, 79, 27, 23, ":Hud/img/17.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.9248, screenH * 0.1120, screenW * 0.0605, screenH * 0.0143, tocolor(2, 180, 232, 162), false) dxDrawRectangle(screenW * 0.9248, screenH * 0.1120, screenW * 0.0605, screenH * 0.0143, tocolor(1, 174, 225, 254), false) dxDrawRectangle(screenW * 0.7822, screenH * 0.1549, screenW * 0.0918, screenH * 0.0378, tocolor(0, 0, 0, 194), false) dxDrawText("Oxigenio:"..Oxigenio.."%", screenW * 0.7813, screenH * 0.1576, screenW * 0.8740, screenH * 0.1927, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("R$"..dinheiro.., screenW * 0.7813, screenH * 0.2018, screenW * 0.9688, screenH * 0.2227, tocolor(53, 251, 0, 194), 2.00, "default-bold", "left", "top", false, false, false, false, false) end ) addEventHandler( "onClientRender", getRootElement(), hud ) Edited May 5, 2019 by DNL291 Use o botão para o código Lua da próxima vez Link to comment
Eficiencia Posted May 5, 2019 Author Share Posted May 5, 2019 40 minutes ago, Eficiencia said: oi, sou novo na area de programaçao em .lua e fazer paineis dx. bom resolvi fazer uma hud, o mta reconhece o script mas a hud na aparece quando executo o mesmo. codigo: local screenW, screenH = guiGetScreenSize() function hud () local vida = getElementHealth ( localPlayer ) local colete = getPedArmor ( localPlayer ) local muniçao = getPedAmmoInClip ( localPlayer ) local total = getPedTotalAmmo ( localPlayer ) local Oxigenio = getPedOxygenLevel ( localPlayer ) local dinheiro = getPlayerMoney ( localPlayer ) local arma = gerPedWeapon ( localPlayer ) local vidaatual = (screenW * 0.0889) * (vida/100) local coleteatual = (screenW * 0.0889) * (colete/100) dxDrawRectangle(screenW * 0.7148, screenH * 0.0000, screenW * 0.2852, screenH * 0.0859, tocolor(0, 0, 0, 193), false) dxDrawImage(screenW * 0.7246, screenH * 0.0195, screenW * 0.0381, screenH * 0.0430, ":Hud/img/22.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.7686, screenH * 0.0273, screenW * 0.0889, screenH * 0.0273, tocolor(173, 0, 0, 126), false) dxDrawRectangle(screenW * 0.7686, screenH * 0.0273, vidaatual, screenH * 0.0273, tocolor(173, 0, 0, 254), false) dxDrawImage(screenW * 0.8633, screenH * 0.0143, screenW * 0.0342, screenH * 0.0456, ":Hud/img/27.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.9014, screenH * 0.0273, screenW * 0.0889, screenH * 0.0273, tocolor(116, 116, 116, 141), false) dxDrawRectangle(screenW * 0.9014, screenH * 0.0273, coleteatual, screenH * 0.0273, tocolor(116, 116, 116, 254), false) dxDrawImage(screenW * 0.7207, screenH * 0.0859, screenW * 0.0576, screenH * 0.0716, ":Hud/armas/"..arma..".png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("1|0", (screenW * 0.7246) - 1, (screenH * 0.1589) - 1, (screenW * 0.7725) - 1, (screenH * 0.1797) - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("1|0", (screenW * 0.7246) + 1, (screenH * 0.1589) - 1, (screenW * 0.7725) + 1, (screenH * 0.1797) - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("1|0", (screenW * 0.7246) - 1, (screenH * 0.1589) + 1, (screenW * 0.7725) - 1, (screenH * 0.1797) + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("1|0", (screenW * 0.7246) + 1, (screenH * 0.1589) + 1, (screenW * 0.7725) + 1, (screenH * 0.1797) + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("1|0", screenW * 0.7246, screenH * 0.1589, screenW * 0.7725, screenH * 0.1797, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.7832, screenH * 0.0924, screenW * 0.2070, screenH * 0.0534, tocolor(1, 1, 1, 197), false) dxDrawImage(807, 76, 30, 26, ":Hud/img/10.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.8271, screenH * 0.1120, screenW * 0.0605, screenH * 0.0143, tocolor(129, 130, 0, 197), false) dxDrawRectangle(screenW * 0.8271, screenH * 0.1120, screenW * 0.0605, screenH * 0.0143, tocolor(233, 235, 0, 254), false) dxDrawImage(914, 79, 27, 23, ":Hud/img/17.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.9248, screenH * 0.1120, screenW * 0.0605, screenH * 0.0143, tocolor(2, 180, 232, 162), false) dxDrawRectangle(screenW * 0.9248, screenH * 0.1120, screenW * 0.0605, screenH * 0.0143, tocolor(1, 174, 225, 254), false) dxDrawRectangle(screenW * 0.7822, screenH * 0.1549, screenW * 0.0918, screenH * 0.0378, tocolor(0, 0, 0, 194), false) dxDrawText("Oxigenio:"..Oxigenio.."%", screenW * 0.7813, screenH * 0.1576, screenW * 0.8740, screenH * 0.1927, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("R$"..dinheiro.., screenW * 0.7813, screenH * 0.2018, screenW * 0.9688, screenH * 0.2227, tocolor(53, 251, 0, 194), 2.00, "default-bold", "left", "top", false, false, false, false, false) end ) addEventHandler( "onClientRender", getRootElement(), hud ) Link to comment
#DeltaSCR Posted May 5, 2019 Share Posted May 5, 2019 Olá @Eficiencia, por favor, visite estes tópicos antes de postar qualquer coisa nesta seção; Obviamente não vai funcionar, primeiro por que tem um parênteses fechando algo inexistente em sua linha 41, e segundo que seu código apresenta algumas falhas na identação. Cheque sempre o debug Link to comment
Jonas^ Posted May 5, 2019 Share Posted May 5, 2019 local screenW, screenH = guiGetScreenSize() addEventHandler ("onClientRender", root, function () local vida = getElementHealth ( localPlayer ) local colete = getPedArmor ( localPlayer ) local muniçao = getPedAmmoInClip ( localPlayer ) local total = getPedTotalAmmo ( localPlayer ) local Oxigenio = getPedOxygenLevel ( localPlayer ) local dinheiro = getPlayerMoney ( localPlayer ) local arma = gerPedWeapon ( localPlayer ) local vidaatual = (screenW * 0.0889) * (vida/100) local coleteatual = (screenW * 0.0889) * (colete/100) -- dxDrawRectangle(screenW * 0.7148, screenH * 0.0000, screenW * 0.2852, screenH * 0.0859, tocolor(0, 0, 0, 193), false) dxDrawImage(screenW * 0.7246, screenH * 0.0195, screenW * 0.0381, screenH * 0.0430, ":Hud/img/22.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.7686, screenH * 0.0273, screenW * 0.0889, screenH * 0.0273, tocolor(173, 0, 0, 126), false) dxDrawRectangle(screenW * 0.7686, screenH * 0.0273, vidaatual, screenH * 0.0273, tocolor(173, 0, 0, 254), false) dxDrawImage(screenW * 0.8633, screenH * 0.0143, screenW * 0.0342, screenH * 0.0456, ":Hud/img/27.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.9014, screenH * 0.0273, screenW * 0.0889, screenH * 0.0273, tocolor(116, 116, 116, 141), false) dxDrawRectangle(screenW * 0.9014, screenH * 0.0273, coleteatual, screenH * 0.0273, tocolor(116, 116, 116, 254), false) dxDrawImage(screenW * 0.7207, screenH * 0.0859, screenW * 0.0576, screenH * 0.0716, ":Hud/armas/"..arma..".png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("1|0", (screenW * 0.7246) - 1, (screenH * 0.1589) - 1, (screenW * 0.7725) - 1, (screenH * 0.1797) - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("1|0", (screenW * 0.7246) + 1, (screenH * 0.1589) - 1, (screenW * 0.7725) + 1, (screenH * 0.1797) - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("1|0", (screenW * 0.7246) - 1, (screenH * 0.1589) + 1, (screenW * 0.7725) - 1, (screenH * 0.1797) + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("1|0", (screenW * 0.7246) + 1, (screenH * 0.1589) + 1, (screenW * 0.7725) + 1, (screenH * 0.1797) + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("1|0", screenW * 0.7246, screenH * 0.1589, screenW * 0.7725, screenH * 0.1797, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(screenW * 0.7832, screenH * 0.0924, screenW * 0.2070, screenH * 0.0534, tocolor(1, 1, 1, 197), false) dxDrawImage(807, 76, 30, 26, ":Hud/img/10.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.8271, screenH * 0.1120, screenW * 0.0605, screenH * 0.0143, tocolor(129, 130, 0, 197), false) dxDrawRectangle(screenW * 0.8271, screenH * 0.1120, screenW * 0.0605, screenH * 0.0143, tocolor(233, 235, 0, 254), false) dxDrawImage(914, 79, 27, 23, ":Hud/img/17.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(screenW * 0.9248, screenH * 0.1120, screenW * 0.0605, screenH * 0.0143, tocolor(2, 180, 232, 162), false) dxDrawRectangle(screenW * 0.9248, screenH * 0.1120, screenW * 0.0605, screenH * 0.0143, tocolor(1, 174, 225, 254), false) dxDrawRectangle(screenW * 0.7822, screenH * 0.1549, screenW * 0.0918, screenH * 0.0378, tocolor(0, 0, 0, 194), false) dxDrawText("Oxigenio:"..Oxigenio.."%", screenW * 0.7813, screenH * 0.1576, screenW * 0.8740, screenH * 0.1927, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawText("R$"..dinheiro.., screenW * 0.7813, screenH * 0.2018, screenW * 0.9688, screenH * 0.2227, tocolor(53, 251, 0, 194), 2.00, "default-bold", "left", "top", false, false, false, false, false) end) EDIT: Não testado. Link to comment
Eficiencia Posted May 5, 2019 Author Share Posted May 5, 2019 2 hours ago, #DeltaSCR said: Olá @Eficiencia, por favor, visite estes tópicos antes de postar qualquer coisa nesta seção; Obviamente não vai funcionar, primeiro por que tem um parênteses fechando algo inexistente em sua linha 41, e segundo que seu código apresenta algumas falhas na identação. Cheque sempre o debug peço desculpa pelo formato errado. Antes de pedir ajuda aqui tentei passar no debug mas ele nao alegou nenhum erro 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