EW1611 Posted October 2, 2019 Share Posted October 2, 2019 Olá, quando o resource inicia ele esconde a hud original do gta, mas quando o player loga a hud do gta continua sendo mostrada, esse é o codigo local components = { "area_name", "radio", "vehicle_name" } function setHud() addEventHandler("onClientRender", getRootElement(), f_hud) setPlayerHudComponentVisible("armour", false) setPlayerHudComponentVisible("wanted", false) setPlayerHudComponentVisible("weapon", false) setPlayerHudComponentVisible("money", false) setPlayerHudComponentVisible("health", false) setPlayerHudComponentVisible("clock", false) setPlayerHudComponentVisible("breath", false) setPlayerHudComponentVisible("ammo", false) setPlayerHudComponentVisible("radar", false) for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), setHud) addEventHandler("onPlayerJoin", getRootElement(), setHud) addEventHandler("onPlayerSpawn", getRootElement(), setHud) addEventHandler("onPlayerWasted", getRootElement(), setHud) addEventHandler("onPlayerJoin", getRootElement(), 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) setPlayerHudComponentVisible("radar", true) end addEventHandler("onClientResourceStop", getResourceRootElement(getThisResource()), removeHud) Link to comment
DNL291 Posted October 3, 2019 Share Posted October 3, 2019 Não tem nada que irá fazer o hud mostrar quando não deve no código acima. Pode ser que esse trecho esteja em outro script. Tente procurar pelo nome da função em cada arquivo. Link to comment
EW1611 Posted October 4, 2019 Author Share Posted October 4, 2019 Essa é uma parte do código da hud que estou usando, o código inteiro é esse: local screenW,screenH = guiGetScreenSize() local resW, resH = 1366,768 local x, y = (screenW/resW), (screenH/resH) local components = { "area_name", "radio", "vehicle_name" } local font = dxCreateFont('files/fonts/font.ttf', 10, false); local font2 = dxCreateFont('files/fonts/font.ttf', 14, false); function f_hud( ... ) if (not isPlayerMapVisible()) then local money = convertNumber(getPlayerMoney(getLocalPlayer())) local bank = convertNumber(getElementData(localPlayer, "Bank:Royal") or "0") local realName = math.floor(getElementHealth(localPlayer)) local level = getElementData(getLocalPlayer(), "Level") or 0 local Cargo_Atual = getElementData(localPlayer, "DNL:Cargo") exports["blur"]:dxDrawBluredRectangle(x*1180, y*50-25, x*180, y*35, tocolor(255, 255, 255, 255)) exports["blur"]:dxDrawBluredRectangle(x*1180, y*100-25, x*180, y*35, tocolor(255, 255, 255, 255)) exports["blur"]:dxDrawBluredRectangle(x*1180, y*150-25, x*180, y*35, tocolor(255, 255, 255, 255)) exports["blur"]:dxDrawBluredRectangle(x*1180, y*200-25, x*180, y*35, tocolor(255, 255, 255, 255)) exports["blur"]:dxDrawBluredRectangle(x*1000, y*50-25, x*160, y*35, tocolor(255, 255, 255, 255)) exports["blur"]:dxDrawBluredRectangle(x*1040, y*100-25, x*120, y*35, tocolor(255, 255, 255, 255)) dxDrawRectangle(x*1180, y*50-25, x*180, y*35, tocolor(0, 0, 0, 150), false) dxDrawRectangle(x*1180, y*100-25, x*180, y*35, tocolor(0, 0, 0, 150), false) dxDrawRectangle(x*1180, y*150-25, x*180, y*35, tocolor(0, 0, 0, 150), false) dxDrawRectangle(x*1180, y*200-25, x*180, y*35, tocolor(0, 0, 0, 150), false) dxDrawRectangle(x*1000, y*50-25, x*160, y*35, tocolor(0, 0, 0, 150), false) dxDrawRectangle(x*1040, y*100-25, x*120, y*35, tocolor(0, 0, 0, 150), false) dxDrawText(" "..(getElementData(localPlayer,"fome") or 0),x*1015+5, y*60-25, x*1470+5, y*30, tocolor(255, 255, 255, 230), 1.05, font, "left", "top", false, false, false, true, false) dxDrawText(" "..(getElementData(localPlayer,"sede") or 0),x*1085+10, y*60-25, x*1540+10, y*30, tocolor(255, 255, 255, 230), 1.05, font, "left", "top", false, false, false, true, false) dxDrawLine(x*1360, y*85-25, x*1180, y*85-25, tocolor(255, 0, 0, 150), 3, false) dxDrawLine(x*1360, y*135-25, x*1180, y*135-25, tocolor(255, 0, 0, 150), 3, false) dxDrawLine(x*1360, y*185-25, x*1180, y*185-25, tocolor(255, 0, 0, 150), 3, false) dxDrawLine(x*1360, y*235-25, x*1180, y*235-25, tocolor(255, 0, 0, 150), 3, false) dxDrawLine(x*1000, y*85-25, x*1160, y*85-25, tocolor(255, 0, 0, 150), 3, false) dxDrawLine(x*1040, y*135-25, x*1160, y*135-25, tocolor(255, 0, 0, 150), 3, false) dxDrawImage(x*1185+20, y*57-25, x*22, y*22, "files/img/name.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*1185+90, y*57-25, x*22, y*22, "files/img/colete.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*1185, y*108-25, x*20, y*20, "files/img/maleta.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*1184, y*155-25, x*25, y*25, "files/img/money.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*1185, y*205-25, x*25, y*25, "files/img/card.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*1005+5, y*55-25, x*27, y*27, "files/img/exp.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*1015+70, y*55-25, x*27, y*27, "files/img/sede.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*1042, y*105-25, x*27, y*27, "files/img/level.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("R$: "..money, x*1210, y*160-25, x*1132, y*37, tocolor(255, 255, 255, 230), 1.00, font, "left", "top", false, false, false, true, false) dxDrawText("R$: "..bank, x*1215, y*210-25, x*150, y*23, tocolor(255, 255, 255, 230), 1.00, font, "left", "top", false, false, false, true, false) dxDrawText(" Nivel: " ..(getElementData(getLocalPlayer(), "Level") or 0), x*1050, y*110-25, x*150, y*37, tocolor(255, 255, 255, 255), 0.9, font, "left", "top", false, false, false, true, false) dxDrawText(realName, x*1215+20, y*62-28, x*1220+40, y*30, tocolor(255, 255, 255, 255), 1.05, font, "left", "top", false, false, false, true, false) dxDrawText(getPedArmor(localPlayer), x*1215+90, y*62-28, x*1220+40, y*30, tocolor(255, 255, 255, 255), 1.05, font, "left", "top", false, false, false, true, false) local Encaminhado = getElementData ( localPlayer, "Emprego") or "Desempregado" dxDrawText(""..(getElementData ( localPlayer, "Emprego") or "Desempregado"), x*1215, y*112-25, x*1132, y*37, tocolor(255, 255, 255, 230), x*0.9, font, "left", "top", false, false, false, false, false) end end function toggleF11() if isVisible then addEventHandler("onClientRender", root, f_hud) else removeEventHandler("onClientRender", root, f_hud) end isVisible = not isVisible end bindKey ("F11", "down", toggleF11) function setHud() addEventHandler("onClientRender", getRootElement(), f_hud) setPlayerHudComponentVisible("armour", false) setPlayerHudComponentVisible("wanted", false) setPlayerHudComponentVisible("weapon", false) setPlayerHudComponentVisible("money", false) setPlayerHudComponentVisible("health", false) setPlayerHudComponentVisible("clock", false) setPlayerHudComponentVisible("breath", false) setPlayerHudComponentVisible("ammo", false) setPlayerHudComponentVisible("radar", false) for _, component in ipairs( components ) do setPlayerHudComponentVisible( component, false ) end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), setHud) addEventHandler("onPlayerJoin", getResourceRootElement(getThisResource()), setHud) addEventHandler("onPlayerSpawn", getResourceRootElement(getThisResource()), setHud) addEventHandler("onPlayerWasted", getResourceRootElement(getThisResource()), setHud) addEventHandler("onPlayerJoin", 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) setPlayerHudComponentVisible("radar", true) end addEventHandler("onClientResourceStop", getResourceRootElement(getThisResource()), removeHud) function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1.%2') if ( k==0 ) then break end end return formatted end function getPedMaxHealth(ped) assert(isElement(ped) and (getElementType(ped) == "ped" or getElementType(ped) == "player"), "Bad argument @ 'getPedMaxHealth' [Expected ped/player at argument 1, got " .. tostring(ped) .. "]") local stat = getPedStat(ped, 24) local maxhealth = 100 + (stat - 569) / 4.31 return math.max(1, maxhealth) end ------------------------------------------------------------------------ [[ RETIRAR HUD ORIGINAL ]] ------------------------------------------------------------------------ --[[function hideall(player) showPlayerHudComponent ( "ammo", false ) showPlayerHudComponent ( "area_name", false ) showPlayerHudComponent ( "armour", false ) showPlayerHudComponent ( "breath", false ) showPlayerHudComponent ( "clock", false ) showPlayerHudComponent ( "health", false ) showPlayerHudComponent ( "money", false ) showPlayerHudComponent ( "vehicle_name", false ) showPlayerHudComponent ( "weapon", false ) showPlayerHudComponent ( "radio", false ) showPlayerHudComponent ( "radar", false ) showPlayerHudComponent ( "wanted", false ) end addEventHandler ( "onClientResourceStart", getRootElement(), hideall ) function showall(player) showPlayerHudComponent ( "ammo", true ) showPlayerHudComponent ( "area_name", true ) showPlayerHudComponent ( "armour", true ) showPlayerHudComponent ( "breath", true ) showPlayerHudComponent ( "clock", true ) showPlayerHudComponent ( "health", true ) showPlayerHudComponent ( "money", true ) showPlayerHudComponent ( "vehicle_name", true ) showPlayerHudComponent ( "weapon", true ) showPlayerHudComponent ( "radio", true ) showPlayerHudComponent ( "radar", true ) showPlayerHudComponent ( "wanted", false ) end addEventHandler ( "onClientResourceStop", resourceRoot, showall ) ]]-- 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