HG Snuuk Posted August 31, 2019 Posted August 31, 2019 Opa tudo bom , sou eu dnv aki enchendo o saco , é que estou tendo problemas tentei pegar umas referencias para dar show na hud porem só consigui na hud padrão do gta e eu queria dar show na hud personalizada e no radar personalizado tbm Script ----- v bindKey( "F10", "down", function() if isShowCustomHud() == false then showCustomHud(true) showChat(true) else showCustomHud(false) showChat(false) end end) addEventHandler("onClientResourceStart", root, function() showCustomHud(true) end) function getPointFromDistanceRotation(x, y, dist, angle) local a = math.rad(90 - angle); local dx = math.cos(a) * dist; local dy = math.sin(a) * dist; return x+dx, y+dy; end function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end; return t; end
HG Snuuk Posted August 31, 2019 Author Posted August 31, 2019 não , acredito eu é que estou errando heim algum evento pq ele tira apenas a hud padrão heim quanto isso eu gostaria de retirar tanto a hud quanto o radar personalizado
DNL291 Posted September 1, 2019 Posted September 1, 2019 Onde está definida as funções showCustomHud e isShowCustomHud? Mostre o código completo da hud.
HG Snuuk Posted September 1, 2019 Author Posted September 1, 2019 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 = getPlayerName(getLocalPlayer()) local Cargo_Atual = getElementData(localPlayer, "DNL:Cargo") local weapon = getPedWeapon ( getLocalPlayer() ) local arma = getWeaponNameFromID ( weapon ) local showammo1 = getPedAmmoInClip (localPlayer,getPedWeaponSlot(localPlayer)) local showammo2 = getPedTotalAmmo(localPlayer)-getPedAmmoInClip(localPlayer) local showammo3 = getPedTotalAmmo(getLocalPlayer()) if arma == Fist then arma = Sono end dxDrawRectangle(x*1180, y*50, x*160, y*35, tocolor(0, 0, 0, 230), false) dxDrawRectangle(x*1180, y*100, x*160, y*35, tocolor(0, 0, 0, 230), false) dxDrawRectangle(x*1180, y*150, x*160, y*35, tocolor(0, 0, 0, 230), false) dxDrawLine(x*1340, y*85, x*1180, y*85, tocolor(255, 0, 90, 255), 3, false) dxDrawLine(x*1340, y*135, x*1180, y*135, tocolor(255, 0, 90, 255), 3, false) dxDrawLine(x*1340, y*185, x*1180, y*185, tocolor(255, 0, 90, 255), 3, false) dxDrawImage(x*1180, y*155, x*35, y*35, "files/img/card.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*1180, y*110, x*22, y*20, "files/img/money.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*1185, y*60, x*20, y*20, "files/img/maleta.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText("R$: "..money, x*1240, y*110, x*1132, y*37, tocolor(255, 255, 255, 221), 1.00, font, "left", "top", false, false, false, true, false) dxDrawText("R$: "..bank, x*1240, y*160, x*1132, y*37, tocolor(255, 255, 255, 221), 1.00, font, "left", "top", false, false, false, true, false) dxDrawText("Arma: "..arma.. " | Pente: " ..tostring (showammo1).." / "..tostring (showammo2), x*1187, y*400, x*1160, y*10, tocolor(255, 255, 255, 255), x*0.7, font, "left", "center", false, false, true, false, false) local Encaminhado = getElementData ( localPlayer, "Emprego") or "Desempregado" dxDrawText(Encaminhado, x*1230, y*60, x*1470, y*30, tocolor(255, 255, 255, 221), x*1.00, font, "left", "top", false, false, false, false, false) end end addEventHandler("onClientRender", root, f_hud) 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() 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) 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
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