DNL291 Posted December 5, 2019 Posted December 5, 2019 Como se trata de uma HUD personalizada (DX), vai precisar criar uma função para remover o DX da tela. @wesley souza angelo (estou marcando para ajudar a localizar o tópico que foi postado na área errada, pois para não poluir o fórum, evito deixar o link do tópico lá)
wesley souza angelo Posted December 5, 2019 Author Posted December 5, 2019 como faço isso ? local screenH, screenW = guiGetScreenSize() local x, y = (screenH/1366), (screenW/768) local fonte = dxCreateFont("files/fonts/fonte.ttf", 10) --[[ dxDrawRectangle(451, 298, 186, 97, tocolor(0, 0, 0, 122), false) dxDrawRectangle(461, 308, 166, 77, tocolor(229, 112, 17, 208), false) ]] function HUD () if getElementData(getLocalPlayer(), "isPolice") then jobPolice = "Policial" else jobPolice = nil end local showammo1 = getPedAmmoInClip (localPlayer,getPedWeaponSlot(localPlayer)) local showammo2 = getPedTotalAmmo(localPlayer)-getPedAmmoInClip(localPlayer) local showammo3 = getPedTotalAmmo(getLocalPlayer()) local clip = getPedAmmoInClip (getLocalPlayer()) local weapon = getPedWeapon ( getLocalPlayer() ) local arma = getWeaponNameFromID ( weapon ) local SaldoBanco = getElementData(localPlayer,"banco:Saldo") or 0 local Procurado = getPlayerWantedLevel(localPlayer) local Level = getElementData(localPlayer,"Level") or 0 local Fome = getElementData(getLocalPlayer(), "hunger") or 0 local Emp = jobPolice or (getElementData(getLocalPlayer(), "Emprego") or "Desempregado") local Sede = getElementData(getLocalPlayer(), "sede") or 0 local Sono = getElementData(getLocalPlayer(), "AirNew:Sono") or 0 local dinheiro1 = ("%008d"):format(getPlayerMoney(getLocalPlayer())) local color1 = tocolor(0,0,0,178) local color2 = tocolor(0,0,0,178) local color3 = tocolor(0,0,0,178) if arma == Fist then arma = Sono end if Fome > 10 then color1 = tocolor(0,0,0,178) else color1 = tocolor(238,89,16,math.abs(math.sin(getTickCount()/200))*200) end if Sede > 10 then color2 = tocolor(0,0,0,178) else color2 = tocolor(65,105,225,math.abs(math.sin(getTickCount()/200))*200) end if Sono > 10 then color3 = tocolor(0,0,0,178) else color3 = tocolor(34,139,34,math.abs(math.sin(getTickCount()/200))*200) end if Fome < 100 then ptfome = x*1148 else ptfome = x*1143 end if Sede < 100 then ptsede = x*1210 else ptsede = x*1205 end if Sono < 100 then ptsono = x*1273 else ptsono = x*1268 end dxDrawImage(x*1110, y*-25, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*16, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*61, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*107, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*154, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), false) dxDrawImage(x*1134, y*18, x*26, y*30, "files/img/IconeMala.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1134, y*54, x*31, y*38, "files/img/IconeDinheiro.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1139, y*102, x*23, y*26, "files/img/IconeCartao.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1140, y*198, x*23, y*21, "files/img/EstrelaIcone.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawText("Level: "..Level, x*1139, y*154, x*1202, y*173, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawCircle (x*1161, y*270, x*20, 0.0, 360.0, color1, color1 ) dxDrawCircle (x*1223, y*270, x*20, 0.0, 360.0, color2, color2 ) dxDrawCircle (x*1284, y*270, x*20, 0.0, 360.0, color3, color3 ) dxDrawText(math.floor(Fome).. "%",ptfome , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(math.floor(Sede).. "%",ptsede , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(math.floor(Sono).. "%",ptsono , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawImage(x*1270, y*256, x*27, y*31, "files/img/SonoIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawImage(x*1207, y*256, x*30, y*27, "files/img/DrinkIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawImage(x*1146, y*256, x*26, y*27, "files/img/ComidaIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawText(""..SaldoBanco, x*1175, y*107, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(""..Procurado, x*1169, y*198, x*1189, y*219, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText("$"..dinheiro1, x*1175, y*61, x*1195, y*82, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(Emp, x*1175, y*-16, x*1195, y*82, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText("Arma: "..arma.. " || Pente: " ..tostring (showammo1).." / "..tostring (showammo2), x*1143, y*400, x*1195, y*82, tocolor(255, 255, 255, 255), x*0.9, fonte, "left", "center", false, false, true, false, false) end addEventHandler("onClientRender", getRootElement(), HUD) function OnStop () 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()), OnStop) function OnStart () setPlayerHudComponentVisible("armour", false) setPlayerHudComponentVisible("wanted", false) setPlayerHudComponentVisible("weapon", false) setPlayerHudComponentVisible("money", false) setPlayerHudComponentVisible("health", false) setPlayerHudComponentVisible("clock", false) setPlayerHudComponentVisible("breath", false) setPlayerHudComponentVisible("ammo", false) end addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), OnStart ) local hudTable = { "ammo", "armour", "clock", "health", "money", "weapon", "wanted", "area_name", "vehicle_name", "breath", "clock" } addEventHandler("onClientResourceStart", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, false) end end ) addEventHandler("onClientResourceStop", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, true) end end )
Other Languages Moderators Lord Henry Posted December 5, 2019 Other Languages Moderators Posted December 5, 2019 @wesley souza angelo favor utilizar o botão <> do fórum para postar códigos. Não cole direto no texto.
DNL291 Posted December 6, 2019 Posted December 6, 2019 Ops, eu tinha movido o tópico para o lugar errado @wesley souza angelo Corrigi seu código com a sintaxe Lua, lembre-se de fazer o que o Lord Henry disse. Aqui tá o código com função de alternar o DX, Client: local screenH, screenW = guiGetScreenSize() local x, y = (screenH/1366), (screenW/768) local fonte = dxCreateFont("files/fonts/fonte.ttf", 10) --[[ dxDrawRectangle(451, 298, 186, 97, tocolor(0, 0, 0, 122), false) dxDrawRectangle(461, 308, 166, 77, tocolor(229, 112, 17, 208), false) ]] local hud_rendering = false function HUD () if getElementData(getLocalPlayer(), "isPolice") then jobPolice = "Policial" else jobPolice = nil end local showammo1 = getPedAmmoInClip (localPlayer,getPedWeaponSlot(localPlayer)) local showammo2 = getPedTotalAmmo(localPlayer)-getPedAmmoInClip(localPlayer) local showammo3 = getPedTotalAmmo(getLocalPlayer()) local clip = getPedAmmoInClip (getLocalPlayer()) local weapon = getPedWeapon ( getLocalPlayer() ) local arma = getWeaponNameFromID ( weapon ) local SaldoBanco = getElementData(localPlayer,"banco:Saldo") or 0 local Procurado = getPlayerWantedLevel(localPlayer) local Level = getElementData(localPlayer,"Level") or 0 local Fome = getElementData(getLocalPlayer(), "hunger") or 0 local Emp = jobPolice or (getElementData(getLocalPlayer(), "Emprego") or "Desempregado") local Sede = getElementData(getLocalPlayer(), "sede") or 0 local Sono = getElementData(getLocalPlayer(), "AirNew:Sono") or 0 local dinheiro1 = ("%008d"):format(getPlayerMoney(getLocalPlayer())) local color1 = tocolor(0,0,0,178) local color2 = tocolor(0,0,0,178) local color3 = tocolor(0,0,0,178) if arma == Fist then arma = Sono end if Fome > 10 then color1 = tocolor(0,0,0,178) else color1 = tocolor(238,89,16,math.abs(math.sin(getTickCount()/200))*200) end if Sede > 10 then color2 = tocolor(0,0,0,178) else color2 = tocolor(65,105,225,math.abs(math.sin(getTickCount()/200))*200) end if Sono > 10 then color3 = tocolor(0,0,0,178) else color3 = tocolor(34,139,34,math.abs(math.sin(getTickCount()/200))*200) end if Fome < 100 then ptfome = x*1148 else ptfome = x*1143 end if Sede < 100 then ptsede = x*1210 else ptsede = x*1205 end if Sono < 100 then ptsono = x*1273 else ptsono = x*1268 end dxDrawImage(x*1110, y*-25, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*16, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*61, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*107, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*154, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), false) dxDrawImage(x*1134, y*18, x*26, y*30, "files/img/IconeMala.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1134, y*54, x*31, y*38, "files/img/IconeDinheiro.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1139, y*102, x*23, y*26, "files/img/IconeCartao.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1140, y*198, x*23, y*21, "files/img/EstrelaIcone.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawText("Level: "..Level, x*1139, y*154, x*1202, y*173, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawCircle (x*1161, y*270, x*20, 0.0, 360.0, color1, color1 ) dxDrawCircle (x*1223, y*270, x*20, 0.0, 360.0, color2, color2 ) dxDrawCircle (x*1284, y*270, x*20, 0.0, 360.0, color3, color3 ) dxDrawText(math.floor(Fome).. "%",ptfome , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(math.floor(Sede).. "%",ptsede , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(math.floor(Sono).. "%",ptsono , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawImage(x*1270, y*256, x*27, y*31, "files/img/SonoIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawImage(x*1207, y*256, x*30, y*27, "files/img/DrinkIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawImage(x*1146, y*256, x*26, y*27, "files/img/ComidaIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawText(""..SaldoBanco, x*1175, y*107, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(""..Procurado, x*1169, y*198, x*1189, y*219, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText("$"..dinheiro1, x*1175, y*61, x*1195, y*82, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(Emp, x*1175, y*-16, x*1195, y*82, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText("Arma: "..arma.. " || Pente: " ..tostring (showammo1).." / "..tostring (showammo2), x*1143, y*400, x*1195, y*82, tocolor(255, 255, 255, 255), x*0.9, fonte, "left", "center", false, false, true, false, false) end function setHudVisible( bool ) if type(bool) == "boolean" then if bool == hud_rendering then return end local addRemove = bool and addEventHandler or removeEventHandler addRemove( "onClientRender", root, HUD ) hud_rendering = bool end end addEvent( "onServerRequestSetHudVisible", true ) addEventHandler( "onServerRequestSetHudVisible", root, setHudVisible ) function OnStop () 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()), OnStop) function OnStart () setPlayerHudComponentVisible("armour", false) setPlayerHudComponentVisible("wanted", false) setPlayerHudComponentVisible("weapon", false) setPlayerHudComponentVisible("money", false) setPlayerHudComponentVisible("health", false) setPlayerHudComponentVisible("clock", false) setPlayerHudComponentVisible("breath", false) setPlayerHudComponentVisible("ammo", false) end addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), OnStart ) local hudTable = { "ammo", "armour", "clock", "health", "money", "weapon", "wanted", "area_name", "vehicle_name", "breath", "clock" } addEventHandler("onClientResourceStart", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, false) end end ) addEventHandler("onClientResourceStop", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, true) end end ) Server: addEventHandler("onPlayerLogin", root, function() setTimer( function(player) setHudVisible( player, true ) end, 500, 1, source ) end, true, "low") function setHudVisible( player, bool ) if isElement(player) and type(bool) == "boolean" then return triggerClientEvent(player, "onServerRequestSetHudVisible", player, bool) end return false end Não testei, mas o teste cabe a você. No mais, adicione a função exportada no meta.xml: <export function="setHudVisible" type="shared"/> E crie um novo arquivo com o código do lado server; também adicione no meta.
wesley souza angelo Posted December 6, 2019 Author Posted December 6, 2019 Desculpa e que sou Novo aqui, E não sabia Onde Posta, Mas Ainda estou com duvida de onde colocar serv e esse <export function="setHudVisible" type="shared"/> Desculpa E que Realmente Nao sei Nada de script
DNL291 Posted December 7, 2019 Posted December 7, 2019 Cria um arquivo e cole isto: addEventHandler("onPlayerLogin", root, function() setTimer( function(player) setHudVisible( player, true ) end, 500, 1, source ) end, true, "low") function setHudVisible( player, bool ) if isElement(player) and type(bool) == "boolean" then return triggerClientEvent(player, "onServerRequestSetHudVisible", player, bool) end return false end Depois salve como server.Lua, deixe no diretório do resource da Hud DX e no meta.xml inclua o script: <script src="server.Lua" type="server"/> Também cole isto: <export function="setHudVisible" type="shared"/> (no meta.xml) Se não entendeu, mostre aqui o seu arquivo meta.
wesley souza angelo Posted December 7, 2019 Author Posted December 7, 2019 <meta> <info name="Hud RP" author="Sem Autor" version="1.0.0" type="script" /> <script src="c.Lua" type="client" /> <export function="setHudVisible" type="shared"/> <file src="files/fonts/fonte.ttf" /> <file src="files/img/Circulo.png" /> <file src="files/img/ComidaIcone.png" /> <file src="files/img/DrinkIcone.png" /> <file src="files/img/EstrelaIcone.png" /> <file src="files/img/IconeCartao.png" /> <file src="files/img/IconeDinheiro.png" /> <file src="files/img/IconeMala.png" /> <file src="files/img/RetanguloHud.png" /> <file src="files/img/SonoIcone.png" /> </meta>
DNL291 Posted December 7, 2019 Posted December 7, 2019 <meta> <info name="Hud RP" author="Sem Autor" version="1.0.0" type="script" /> <script src="c.Lua" type="client" /> <script src="server.Lua" type="server" /> <export function="setHudVisible" type="shared"/> <file src="files/fonts/fonte.ttf" /> <file src="files/img/Circulo.png" /> <file src="files/img/ComidaIcone.png" /> <file src="files/img/DrinkIcone.png" /> <file src="files/img/EstrelaIcone.png" /> <file src="files/img/IconeCartao.png" /> <file src="files/img/IconeDinheiro.png" /> <file src="files/img/IconeMala.png" /> <file src="files/img/RetanguloHud.png" /> <file src="files/img/SonoIcone.png" /> </meta> Faça um teste e vê se funciona. Obs: deixe .Lua em minúsculo, por algum motivo, o fórum sempre deixa o L maiúsculo.
wesley souza angelo Posted December 7, 2019 Author Posted December 7, 2019 addEventHandler("onPlayerLogin", root, function() setTimer( function(player) setHudVisible( player, true ) end, 500, 1, source ) end, true, "low") function setHudVisible( player, bool ) if isElement(player) and type(bool) == "boolean" then return triggerClientEvent(player, "onServerRequestSetHudVisible", player, bool) end return false end <meta> <info name="Hud RP" author="Sem Autor" version="1.0.0" type="script" /> <script src="c.Lua" type="client" /> <script src="server.Lua" type="server" /> <export function="setHudVisible" type="shared"/> <file src="files/fonts/fonte.ttf" /> <file src="files/img/Circulo.png" /> <file src="files/img/ComidaIcone.png" /> <file src="files/img/DrinkIcone.png" /> <file src="files/img/EstrelaIcone.png" /> <file src="files/img/IconeCartao.png" /> <file src="files/img/IconeDinheiro.png" /> <file src="files/img/IconeMala.png" /> <file src="files/img/RetanguloHud.png" /> <file src="files/img/SonoIcone.png" /> </meta> local screenH, screenW = guiGetScreenSize() local x, y = (screenH/1366), (screenW/768) local fonte = dxCreateFont("files/fonts/fonte.ttf", 10) --[[ dxDrawRectangle(451, 298, 186, 97, tocolor(0, 0, 0, 122), false) dxDrawRectangle(461, 308, 166, 77, tocolor(229, 112, 17, 208), false) ]] function HUD () if getElementData(getLocalPlayer(), "isPolice") then jobPolice = "Policial" else jobPolice = nil end local showammo1 = getPedAmmoInClip (localPlayer,getPedWeaponSlot(localPlayer)) local showammo2 = getPedTotalAmmo(localPlayer)-getPedAmmoInClip(localPlayer) local showammo3 = getPedTotalAmmo(getLocalPlayer()) local clip = getPedAmmoInClip (getLocalPlayer()) local weapon = getPedWeapon ( getLocalPlayer() ) local arma = getWeaponNameFromID ( weapon ) local SaldoBanco = getElementData(localPlayer,"banco:Saldo") or 0 local Procurado = getPlayerWantedLevel(localPlayer) local Level = getElementData(localPlayer,"Level") or 0 local Fome = getElementData(getLocalPlayer(), "hunger") or 0 local Emp = jobPolice or (getElementData(getLocalPlayer(), "Emprego") or "Desempregado") local Sede = getElementData(getLocalPlayer(), "sede") or 0 local Sono = getElementData(getLocalPlayer(), "AirNew:Sono") or 0 local dinheiro1 = ("%008d"):format(getPlayerMoney(getLocalPlayer())) local color1 = tocolor(0,0,0,178) local color2 = tocolor(0,0,0,178) local color3 = tocolor(0,0,0,178) if arma == Fist then arma = Sono end if Fome > 10 then color1 = tocolor(0,0,0,178) else color1 = tocolor(238,89,16,math.abs(math.sin(getTickCount()/200))*200) end if Sede > 10 then color2 = tocolor(0,0,0,178) else color2 = tocolor(65,105,225,math.abs(math.sin(getTickCount()/200))*200) end if Sono > 10 then color3 = tocolor(0,0,0,178) else color3 = tocolor(34,139,34,math.abs(math.sin(getTickCount()/200))*200) end if Fome < 100 then ptfome = x*1148 else ptfome = x*1143 end if Sede < 100 then ptsede = x*1210 else ptsede = x*1205 end if Sono < 100 then ptsono = x*1273 else ptsono = x*1268 end dxDrawImage(x*1110, y*-25, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*16, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*61, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*107, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*154, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), false) dxDrawImage(x*1134, y*18, x*26, y*30, "files/img/IconeMala.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1134, y*54, x*31, y*38, "files/img/IconeDinheiro.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1139, y*102, x*23, y*26, "files/img/IconeCartao.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1140, y*198, x*23, y*21, "files/img/EstrelaIcone.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawText("Level: "..Level, x*1139, y*154, x*1202, y*173, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawCircle (x*1161, y*270, x*20, 0.0, 360.0, color1, color1 ) dxDrawCircle (x*1223, y*270, x*20, 0.0, 360.0, color2, color2 ) dxDrawCircle (x*1284, y*270, x*20, 0.0, 360.0, color3, color3 ) dxDrawText(math.floor(Fome).. "%",ptfome , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(math.floor(Sede).. "%",ptsede , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(math.floor(Sono).. "%",ptsono , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawImage(x*1270, y*256, x*27, y*31, "files/img/SonoIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawImage(x*1207, y*256, x*30, y*27, "files/img/DrinkIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawImage(x*1146, y*256, x*26, y*27, "files/img/ComidaIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawText(""..SaldoBanco, x*1175, y*107, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(""..Procurado, x*1169, y*198, x*1189, y*219, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText("$"..dinheiro1, x*1175, y*61, x*1195, y*82, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(Emp, x*1175, y*-16, x*1195, y*82, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText("Arma: "..arma.. " || Pente: " ..tostring (showammo1).." / "..tostring (showammo2), x*1143, y*400, x*1195, y*82, tocolor(255, 255, 255, 255), x*0.9, fonte, "left", "center", false, false, true, false, false) end addEventHandler("onClientRender", getRootElement(), HUD) function OnStop () 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()), OnStop) function OnStart () setPlayerHudComponentVisible("armour", false) setPlayerHudComponentVisible("wanted", false) setPlayerHudComponentVisible("weapon", false) setPlayerHudComponentVisible("money", false) setPlayerHudComponentVisible("health", false) setPlayerHudComponentVisible("clock", false) setPlayerHudComponentVisible("breath", false) setPlayerHudComponentVisible("ammo", false) end addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), OnStart ) local hudTable = { "ammo", "armour", "clock", "health", "money", "weapon", "wanted", "area_name", "vehicle_name", "breath", "clock" } addEventHandler("onClientResourceStart", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, false) end end ) addEventHandler("onClientResourceStop", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, true) end end ) addEventHandler("onPlayerLogin", root, function() setTimer( function(player) setHudVisible( player, true ) end, 500, 1, source ) end, true, "low") function setHudVisible( player, bool ) if isElement(player) and type(bool) == "boolean" then return triggerClientEvent(player, "onServerRequestSetHudVisible", player, bool) end return false end <meta> <info name="Hud RP" author="Sem Autor" version="1.0.0" type="script" /> <script src="c.Lua" type="client" /> <script src="server.Lua" type="server" /> <export function="setHudVisible" type="shared"/> <file src="files/fonts/fonte.ttf" /> <file src="files/img/Circulo.png" /> <file src="files/img/ComidaIcone.png" /> <file src="files/img/DrinkIcone.png" /> <file src="files/img/EstrelaIcone.png" /> <file src="files/img/IconeCartao.png" /> <file src="files/img/IconeDinheiro.png" /> <file src="files/img/IconeMala.png" /> <file src="files/img/RetanguloHud.png" /> <file src="files/img/SonoIcone.png" /> </meta> local screenH, screenW = guiGetScreenSize() local x, y = (screenH/1366), (screenW/768) local fonte = dxCreateFont("files/fonts/fonte.ttf", 10) --[[ dxDrawRectangle(451, 298, 186, 97, tocolor(0, 0, 0, 122), false) dxDrawRectangle(461, 308, 166, 77, tocolor(229, 112, 17, 208), false) ]] function HUD () if getElementData(getLocalPlayer(), "isPolice") then jobPolice = "Policial" else jobPolice = nil end local showammo1 = getPedAmmoInClip (localPlayer,getPedWeaponSlot(localPlayer)) local showammo2 = getPedTotalAmmo(localPlayer)-getPedAmmoInClip(localPlayer) local showammo3 = getPedTotalAmmo(getLocalPlayer()) local clip = getPedAmmoInClip (getLocalPlayer()) local weapon = getPedWeapon ( getLocalPlayer() ) local arma = getWeaponNameFromID ( weapon ) local SaldoBanco = getElementData(localPlayer,"banco:Saldo") or 0 local Procurado = getPlayerWantedLevel(localPlayer) local Level = getElementData(localPlayer,"Level") or 0 local Fome = getElementData(getLocalPlayer(), "hunger") or 0 local Emp = jobPolice or (getElementData(getLocalPlayer(), "Emprego") or "Desempregado") local Sede = getElementData(getLocalPlayer(), "sede") or 0 local Sono = getElementData(getLocalPlayer(), "AirNew:Sono") or 0 local dinheiro1 = ("%008d"):format(getPlayerMoney(getLocalPlayer())) local color1 = tocolor(0,0,0,178) local color2 = tocolor(0,0,0,178) local color3 = tocolor(0,0,0,178) if arma == Fist then arma = Sono end if Fome > 10 then color1 = tocolor(0,0,0,178) else color1 = tocolor(238,89,16,math.abs(math.sin(getTickCount()/200))*200) end if Sede > 10 then color2 = tocolor(0,0,0,178) else color2 = tocolor(65,105,225,math.abs(math.sin(getTickCount()/200))*200) end if Sono > 10 then color3 = tocolor(0,0,0,178) else color3 = tocolor(34,139,34,math.abs(math.sin(getTickCount()/200))*200) end if Fome < 100 then ptfome = x*1148 else ptfome = x*1143 end if Sede < 100 then ptsede = x*1210 else ptsede = x*1205 end if Sono < 100 then ptsono = x*1273 else ptsono = x*1268 end dxDrawImage(x*1110, y*-25, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*16, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*61, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*107, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*154, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), false) dxDrawImage(x*1134, y*18, x*26, y*30, "files/img/IconeMala.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1134, y*54, x*31, y*38, "files/img/IconeDinheiro.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1139, y*102, x*23, y*26, "files/img/IconeCartao.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1140, y*198, x*23, y*21, "files/img/EstrelaIcone.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawText("Level: "..Level, x*1139, y*154, x*1202, y*173, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawCircle (x*1161, y*270, x*20, 0.0, 360.0, color1, color1 ) dxDrawCircle (x*1223, y*270, x*20, 0.0, 360.0, color2, color2 ) dxDrawCircle (x*1284, y*270, x*20, 0.0, 360.0, color3, color3 ) dxDrawText(math.floor(Fome).. "%",ptfome , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(math.floor(Sede).. "%",ptsede , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(math.floor(Sono).. "%",ptsono , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawImage(x*1270, y*256, x*27, y*31, "files/img/SonoIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawImage(x*1207, y*256, x*30, y*27, "files/img/DrinkIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawImage(x*1146, y*256, x*26, y*27, "files/img/ComidaIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawText(""..SaldoBanco, x*1175, y*107, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(""..Procurado, x*1169, y*198, x*1189, y*219, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText("$"..dinheiro1, x*1175, y*61, x*1195, y*82, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(Emp, x*1175, y*-16, x*1195, y*82, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText("Arma: "..arma.. " || Pente: " ..tostring (showammo1).." / "..tostring (showammo2), x*1143, y*400, x*1195, y*82, tocolor(255, 255, 255, 255), x*0.9, fonte, "left", "center", false, false, true, false, false) end addEventHandler("onClientRender", getRootElement(), HUD) function OnStop () 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()), OnStop) function OnStart () setPlayerHudComponentVisible("armour", false) setPlayerHudComponentVisible("wanted", false) setPlayerHudComponentVisible("weapon", false) setPlayerHudComponentVisible("money", false) setPlayerHudComponentVisible("health", false) setPlayerHudComponentVisible("clock", false) setPlayerHudComponentVisible("breath", false) setPlayerHudComponentVisible("ammo", false) end addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), OnStart ) local hudTable = { "ammo", "armour", "clock", "health", "money", "weapon", "wanted", "area_name", "vehicle_name", "breath", "clock" } addEventHandler("onClientResourceStart", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, false) end end ) addEventHandler("onClientResourceStop", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, true) end end ) Mesmo Assim Não Deu... Testei E A Hud Continua Iniciando Junto Com O Painel
DNL291 Posted December 7, 2019 Posted December 7, 2019 Porque você tá com o código antigo da Hud. Substitui pelo editado: local screenH, screenW = guiGetScreenSize() local x, y = (screenH/1366), (screenW/768) local fonte = dxCreateFont("files/fonts/fonte.ttf", 10) --[[ dxDrawRectangle(451, 298, 186, 97, tocolor(0, 0, 0, 122), false) dxDrawRectangle(461, 308, 166, 77, tocolor(229, 112, 17, 208), false) ]] local hud_rendering = false function HUD () if getElementData(getLocalPlayer(), "isPolice") then jobPolice = "Policial" else jobPolice = nil end local showammo1 = getPedAmmoInClip (localPlayer,getPedWeaponSlot(localPlayer)) local showammo2 = getPedTotalAmmo(localPlayer)-getPedAmmoInClip(localPlayer) local showammo3 = getPedTotalAmmo(getLocalPlayer()) local clip = getPedAmmoInClip (getLocalPlayer()) local weapon = getPedWeapon ( getLocalPlayer() ) local arma = getWeaponNameFromID ( weapon ) local SaldoBanco = getElementData(localPlayer,"banco:Saldo") or 0 local Procurado = getPlayerWantedLevel(localPlayer) local Level = getElementData(localPlayer,"Level") or 0 local Fome = getElementData(getLocalPlayer(), "hunger") or 0 local Emp = jobPolice or (getElementData(getLocalPlayer(), "Emprego") or "Desempregado") local Sede = getElementData(getLocalPlayer(), "sede") or 0 local Sono = getElementData(getLocalPlayer(), "AirNew:Sono") or 0 local dinheiro1 = ("%008d"):format(getPlayerMoney(getLocalPlayer())) local color1 = tocolor(0,0,0,178) local color2 = tocolor(0,0,0,178) local color3 = tocolor(0,0,0,178) if arma == Fist then arma = Sono end if Fome > 10 then color1 = tocolor(0,0,0,178) else color1 = tocolor(238,89,16,math.abs(math.sin(getTickCount()/200))*200) end if Sede > 10 then color2 = tocolor(0,0,0,178) else color2 = tocolor(65,105,225,math.abs(math.sin(getTickCount()/200))*200) end if Sono > 10 then color3 = tocolor(0,0,0,178) else color3 = tocolor(34,139,34,math.abs(math.sin(getTickCount()/200))*200) end if Fome < 100 then ptfome = x*1148 else ptfome = x*1143 end if Sede < 100 then ptsede = x*1210 else ptsede = x*1205 end if Sono < 100 then ptsono = x*1273 else ptsono = x*1268 end dxDrawImage(x*1110, y*-25, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*16, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*61, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*107, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*154, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), false) dxDrawImage(x*1134, y*18, x*26, y*30, "files/img/IconeMala.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1134, y*54, x*31, y*38, "files/img/IconeDinheiro.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1139, y*102, x*23, y*26, "files/img/IconeCartao.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1140, y*198, x*23, y*21, "files/img/EstrelaIcone.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawText("Level: "..Level, x*1139, y*154, x*1202, y*173, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawCircle (x*1161, y*270, x*20, 0.0, 360.0, color1, color1 ) dxDrawCircle (x*1223, y*270, x*20, 0.0, 360.0, color2, color2 ) dxDrawCircle (x*1284, y*270, x*20, 0.0, 360.0, color3, color3 ) dxDrawText(math.floor(Fome).. "%",ptfome , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(math.floor(Sede).. "%",ptsede , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(math.floor(Sono).. "%",ptsono , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawImage(x*1270, y*256, x*27, y*31, "files/img/SonoIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawImage(x*1207, y*256, x*30, y*27, "files/img/DrinkIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawImage(x*1146, y*256, x*26, y*27, "files/img/ComidaIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawText(""..SaldoBanco, x*1175, y*107, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(""..Procurado, x*1169, y*198, x*1189, y*219, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText("$"..dinheiro1, x*1175, y*61, x*1195, y*82, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(Emp, x*1175, y*-16, x*1195, y*82, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText("Arma: "..arma.. " || Pente: " ..tostring (showammo1).." / "..tostring (showammo2), x*1143, y*400, x*1195, y*82, tocolor(255, 255, 255, 255), x*0.9, fonte, "left", "center", false, false, true, false, false) end function setHudVisible( bool ) if type(bool) == "boolean" then if bool == hud_rendering then return end local addRemove = bool and addEventHandler or removeEventHandler addRemove( "onClientRender", root, HUD ) hud_rendering = bool end end addEvent( "onServerRequestSetHudVisible", true ) addEventHandler( "onServerRequestSetHudVisible", root, setHudVisible ) function OnStop () 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()), OnStop) function OnStart () setPlayerHudComponentVisible("armour", false) setPlayerHudComponentVisible("wanted", false) setPlayerHudComponentVisible("weapon", false) setPlayerHudComponentVisible("money", false) setPlayerHudComponentVisible("health", false) setPlayerHudComponentVisible("clock", false) setPlayerHudComponentVisible("breath", false) setPlayerHudComponentVisible("ammo", false) end addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), OnStart ) local hudTable = { "ammo", "armour", "clock", "health", "money", "weapon", "wanted", "area_name", "vehicle_name", "breath", "clock" } addEventHandler("onClientResourceStart", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, false) end end ) addEventHandler("onClientResourceStop", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, true) end end )
wesley souza angelo Posted December 7, 2019 Author Posted December 7, 2019 ERROR: Problem with resource: hud; Couldn't find script server.Lua for resource hud fica sim
Other Languages Moderators Lord Henry Posted December 7, 2019 Other Languages Moderators Posted December 7, 2019 Mostre seu meta.xml
wesley souza angelo Posted December 7, 2019 Author Posted December 7, 2019 <meta> <info name="Hud RP" author="Sem Autor" version="1.0.0" type="script" /> <script src="c.Lua" type="client" /> <script src="server.Lua" type="server" /> <export function="setHudVisible" type="shared"/> <file src="files/fonts/fonte.ttf" /> <file src="files/img/Circulo.png" /> <file src="files/img/ComidaIcone.png" /> <file src="files/img/DrinkIcone.png" /> <file src="files/img/EstrelaIcone.png" /> <file src="files/img/IconeCartao.png" /> <file src="files/img/IconeDinheiro.png" /> <file src="files/img/IconeMala.png" /> <file src="files/img/RetanguloHud.png" /> <file src="files/img/SonoIcone.png" /> </meta>
Other Languages Moderators Lord Henry Posted December 7, 2019 Other Languages Moderators Posted December 7, 2019 (edited) Ele está errado. Lua é com letra minúscula. Edited December 7, 2019 by Lord Henry
wesley souza angelo Posted December 7, 2019 Author Posted December 7, 2019 eu sei e porque quando joga aqui fica maiúscula
Other Languages Moderators Lord Henry Posted December 7, 2019 Other Languages Moderators Posted December 7, 2019 De qualquer forma, o erro aponta que não foi possível encontrar o script server.Lua, verifique se ele existe na pasta do seu resource e está exatamente com este nome.
wesley souza angelo Posted December 7, 2019 Author Posted December 7, 2019 são quatro pastas >> files >> c >> meta >> server.Lua
DNL291 Posted December 7, 2019 Posted December 7, 2019 Só fazer o que eu disse aqui 20 hours ago, DNL291 said: Obs: deixe .Lua em minúsculo, por algum motivo, o fórum sempre deixa o L maiúsculo. Quando copiar o código do meta daqui do fórum, edite para .Lua minúsculo. e também na extensão do arquivo.
wesley souza angelo Posted December 7, 2019 Author Posted December 7, 2019 local screenH, screenW = guiGetScreenSize() local x, y = (screenH/1366), (screenW/768) local fonte = dxCreateFont("files/fonts/fonte.ttf", 10) --[[ dxDrawRectangle(451, 298, 186, 97, tocolor(0, 0, 0, 122), false) dxDrawRectangle(461, 308, 166, 77, tocolor(229, 112, 17, 208), false) ]] local hud_rendering = false function HUD () if getElementData(getLocalPlayer(), "isPolice") then jobPolice = "Policial" else jobPolice = nil end local showammo1 = getPedAmmoInClip (localPlayer,getPedWeaponSlot(localPlayer)) local showammo2 = getPedTotalAmmo(localPlayer)-getPedAmmoInClip(localPlayer) local showammo3 = getPedTotalAmmo(getLocalPlayer()) local clip = getPedAmmoInClip (getLocalPlayer()) local weapon = getPedWeapon ( getLocalPlayer() ) local arma = getWeaponNameFromID ( weapon ) local SaldoBanco = getElementData(localPlayer,"banco:Saldo") or 0 local Procurado = getPlayerWantedLevel(localPlayer) local Level = getElementData(localPlayer,"Level") or 0 local Fome = getElementData(getLocalPlayer(), "hunger") or 0 local Emp = jobPolice or (getElementData(getLocalPlayer(), "Emprego") or "Desempregado") local Sede = getElementData(getLocalPlayer(), "sede") or 0 local Sono = getElementData(getLocalPlayer(), "AirNew:Sono") or 0 local dinheiro1 = ("%008d"):format(getPlayerMoney(getLocalPlayer())) local color1 = tocolor(0,0,0,178) local color2 = tocolor(0,0,0,178) local color3 = tocolor(0,0,0,178) if arma == Fist then arma = Sono end if Fome > 10 then color1 = tocolor(0,0,0,178) else color1 = tocolor(238,89,16,math.abs(math.sin(getTickCount()/200))*200) end if Sede > 10 then color2 = tocolor(0,0,0,178) else color2 = tocolor(65,105,225,math.abs(math.sin(getTickCount()/200))*200) end if Sono > 10 then color3 = tocolor(0,0,0,178) else color3 = tocolor(34,139,34,math.abs(math.sin(getTickCount()/200))*200) end if Fome < 100 then ptfome = x*1148 else ptfome = x*1143 end if Sede < 100 then ptsede = x*1210 else ptsede = x*1205 end if Sono < 100 then ptsono = x*1273 else ptsono = x*1268 end dxDrawImage(x*1110, y*-25, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*16, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*61, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*107, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), true) dxDrawImage(x*1110, y*154, x*215, y*112, "files/img/RetanguloHud.png", 0, 0, 0, tocolor(0, 0, 0, 255), false) dxDrawImage(x*1134, y*18, x*26, y*30, "files/img/IconeMala.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1134, y*54, x*31, y*38, "files/img/IconeDinheiro.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1139, y*102, x*23, y*26, "files/img/IconeCartao.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*1140, y*198, x*23, y*21, "files/img/EstrelaIcone.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawText("Level: "..Level, x*1139, y*154, x*1202, y*173, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawCircle (x*1161, y*270, x*20, 0.0, 360.0, color1, color1 ) dxDrawCircle (x*1223, y*270, x*20, 0.0, 360.0, color2, color2 ) dxDrawCircle (x*1284, y*270, x*20, 0.0, 360.0, color3, color3 ) dxDrawText(math.floor(Fome).. "%",ptfome , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(math.floor(Sede).. "%",ptsede , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(math.floor(Sono).. "%",ptsono , y*474, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawImage(x*1270, y*256, x*27, y*31, "files/img/SonoIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawImage(x*1207, y*256, x*30, y*27, "files/img/DrinkIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawImage(x*1146, y*256, x*26, y*27, "files/img/ComidaIcone.png", 0, 0, 0, tocolor(254, 254, 254, 187), false) dxDrawText(""..SaldoBanco, x*1175, y*107, x*1195, y*128, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(""..Procurado, x*1169, y*198, x*1189, y*219, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText("$"..dinheiro1, x*1175, y*61, x*1195, y*82, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText(Emp, x*1175, y*-16, x*1195, y*82, tocolor(255, 255, 255, 255), x*1.00, fonte, "left", "center", false, false, true, false, false) dxDrawText("Arma: "..arma.. " || Pente: " ..tostring (showammo1).." / "..tostring (showammo2), x*1143, y*400, x*1195, y*82, tocolor(255, 255, 255, 255), x*0.9, fonte, "left", "center", false, false, true, false, false) end function setHudVisible( bool ) if type(bool) == "boolean" then if bool == hud_rendering then return end local addRemove = bool and addEventHandler or removeEventHandler addRemove( "onClientRender", root, HUD ) hud_rendering = bool end end addEvent( "onServerRequestSetHudVisible", true ) addEventHandler( "onServerRequestSetHudVisible", root, setHudVisible ) function OnStop () 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()), OnStop) function OnStart () setPlayerHudComponentVisible("armour", false) setPlayerHudComponentVisible("wanted", false) setPlayerHudComponentVisible("weapon", false) setPlayerHudComponentVisible("money", false) setPlayerHudComponentVisible("health", false) setPlayerHudComponentVisible("clock", false) setPlayerHudComponentVisible("breath", false) setPlayerHudComponentVisible("ammo", false) end addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), OnStart ) local hudTable = { "ammo", "armour", "clock", "health", "money", "weapon", "wanted", "area_name", "vehicle_name", "breath", "clock" } addEventHandler("onClientResourceStart", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, false) end end ) addEventHandler("onClientResourceStop", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, true) end end ) <meta> <info name="Hud RP" author="Sem Autor" version="1.0.0" type="script" /> <script src="c.Lua" type="client" /> <script src="server.Lua" type="server" /> <export function="setHudVisible" type="shared"/> <file src="files/fonts/fonte.ttf" /> <file src="files/img/Circulo.png" /> <file src="files/img/ComidaIcone.png" /> <file src="files/img/DrinkIcone.png" /> <file src="files/img/EstrelaIcone.png" /> <file src="files/img/IconeCartao.png" /> <file src="files/img/IconeDinheiro.png" /> <file src="files/img/IconeMala.png" /> <file src="files/img/RetanguloHud.png" /> <file src="files/img/SonoIcone.png" /> </meta> addEventHandler("onPlayerLogin", root, function() setTimer( function(player) setHudVisible( player, true ) end, 500, 1, source ) end, true, "low") function setHudVisible( player, bool ) if isElement(player) and type(bool) == "boolean" then return triggerClientEvent(player, "onServerRequestSetHudVisible", player, bool) end return false end Eu ja coloquei Minusculo... Ta ai as pastas >> c << meta<< >> server.Lua<<
DNL291 Posted December 7, 2019 Posted December 7, 2019 https://www.dropbox.com/s/ws4df7ci3e6t04q/hudmta.zip?dl=0 Só copiar a pasta files para o resource. Obs: Descompacte o arquivo. 1
wesley souza angelo Posted December 7, 2019 Author Posted December 7, 2019 vlw, Funcionou Onde eu estava errando ?
DNL291 Posted December 7, 2019 Posted December 7, 2019 Provavelmente na estrutura das pastas dentro do resource, na verdade nem pode usar pastas, ambos arquivos de script devem estar no diretório root do resource, pois estão sendo carregados pela pasta raíz, então movê-los para uma pasta irá causar um erro semelhante ao que você teve. Embora eu não possa afirmar qual foi o verdadeiro problema já que não tive acesso ao seu resource. Isso acredito que você mesmo vai saber comparando com a versão que enviei.
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