Jump to content

Alguém ajuda com este erro


Recommended Posts

local screenW,screenH = guiGetScreenSize()
local resW,resH = 1366,768
local x,y =  (screenW/resW), (screenH/resH)

local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" }

function HUDc()
	local vida1 = math.floor(getElementHealth(getLocalPlayer()))
	local vida2 = getPedMaxHealth(getLocalPlayer())
	local colete = math.floor(getPedArmor(getLocalPlayer()))
	local bankMoney = convertNumber(getElementData(localPlayer, "O mais usado -> Bank:Caixa"))  
	local money = convertNumber(getPlayerMoney()) 
	local procurado = getPlayerWantedLevel(getLocalPlayer())
	local ammoClip = getPedAmmoInClip(getLocalPlayer(), getPedWeaponSlot(getLocalPlayer()))
	local ammo = getPedTotalAmmo(getLocalPlayer()) - getPedAmmoInClip(getLocalPlayer())
	local armaId = getPedWeapon(getLocalPlayer())
	local weapon = getPedWeapon(getLocalPlayer())
	local wanted = getPlayerWantedLevel(getLocalPlayer())
	local Nivel = getElementData ( localPlayer, "Level" ) or 0
	local EXP = getElementData ( localPlayer, "LSys:EXP" ) or 0
	local desemp = getElementData (localPlayer, "Profissão" ) or false
	
        -- ########### BLUR ###########

	    exports["Blur"]:dxDrawBluredRectangle(x*1098, y*16, x*249, y*50, tocolor(255, 255, 255, 255)) --FUNDO MONEY		
		exports["Blur"]:dxDrawBluredRectangle(x*1098, y*125, x*249, y*24, tocolor(255, 255, 255, 255)) --FUNDO PROCURADO
		exports["Blur"]:dxDrawBluredRectangle(x*1098, y*70, x*249, y*24, tocolor(255, 255, 255, 255)) --FUNDO VIDA
		exports["Blur"]:dxDrawBluredRectangle(x*1098, y*98, x*249, y*24, tocolor(255, 255, 255, 255)) --FUNDO COLETE
		exports["Blur"]:dxDrawBluredRectangle(x*1098, y*152, x*249, y*24, tocolor(255, 255, 255, 255)) --FUNDO LEVEL
		exports["Blur"]:dxDrawBluredRectangle(x*1098, y*179, x*249, y*24, tocolor(255, 255, 255, 255)) --FUNDO EXP
		exports["Blur"]:dxDrawBluredRectangle(x*1098, y*205, x*249, y*24, tocolor(255, 255, 255, 255)) --FUNDO EMPREGO

	    -- ########### IMGS ###########
		
		dxDrawImage(x*550, y*0, x*900, y*300, "files/img/background.png", 0, 0, 0, tocolor(254, 254, 254, 255), false)	
		dxDrawImage(x*1075, y*222, x*200, y*105, "files/img/"..tostring(weapon)..".png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
		
		-- ########### HUD DXS ###########
		

		dxDrawRectangle(x*1098, y*125, x*249, y*24, tocolor(0, 0, 0, 137), false) -- NIVEL PROCURADO FUNDO
		dxDrawRectangle(x*1101, y*130, x*241/6*wanted, y*15, tocolor(255, 255, 0, 130), false) --NIVEL DE PROCURADO BARRA		
		
		dxDrawRectangle(x*1098, y*70, x*249, y*24, tocolor(0, 0, 0, 137), false) --VIDA FUNDO
		dxDrawRectangle(x*1101, y*75, x*241/vida2*vida1, y*15, tocolor(124, 252, 0, 130), false) --VIDA BARRA
		
        dxDrawRectangle(x*1098, y*98, x*249, y*24, tocolor(0, 0, 0, 137), false) --COLETE FUNDO
		dxDrawRectangle(x*1101, y*104, x*241/100*colete, y*15, tocolor(16, 102, 231, 130), false) --COLETE BARRA 	

		dxDrawRectangle(x*1098, y*152, x*249, y*24, tocolor(0, 0, 0, 137), false) --LEVEL FUNDO
		dxDrawRectangle(x*1101, y*157, x*241/30*Nivel, y*15, tocolor(255, 140, 0, 130), false) --LEVEL BARRA 	

		dxDrawRectangle(x*1098, y*179, x*249, y*24, tocolor(0, 0, 0, 137), false) --EXP FUNDO
		dxDrawRectangle(x*1101, y*184, x*241/20*EXP, y*15, tocolor(255, 0, 0, 130), false) --EXP BARRA 	

		dxDrawRectangle(x*1098, y*205, x*249, y*24, tocolor(0, 0, 0, 137), false) --EMPREGO FUNDO

		-- ########### TEXTOS ###########

		if wanted > 0 then
		dxDrawText("Nível: "..wanted, x*1200, y*131, x*1179, y*159, tocolor(254, 254, 254, 182), x*1.00, "default", "left", "top", false, false, false, false, false)
	else
		dxDrawText("Sem Nível", x*1200, y*131, x*1179, y*159, tocolor(254, 254, 254, 182), x*1.00, "default", "left", "top", false, false, false, false, false)
	end
		
        dxDrawText(money, x*1140, y*33, x*1038, y*48, tocolor(254, 254, 254, 182), 1.20, "default", "left", "top", false, false, false, false, false)
        dxDrawText(bankMoney, x*1270, y*33, x*1038, y*48, tocolor(254, 254, 254, 182), 1.20, "default", "left", "top", false, false, false, false, false)
        dxDrawText(ammoClip.." | "..ammo, x*1205, y*280, x*1031, y*73, tocolor(254, 254, 254, 182), x*1.20, "default", "left", "top", false, false, false, false, false)
        dxDrawText(vida1.."%", x*1200, y*76, x*1179, y*159, tocolor(255, 255, 255, 255), x*1.00, "default", "left", "top", false, false, false, false, false)
		dxDrawText(colete.."%", x*1200, y*105, x*1179, y*159, tocolor(255, 255, 255, 255), x*1.00, "default", "left", "top", false, false, false, false, false)
		dxDrawText("Level: "..Nivel, x*1380, y*275, x*1072, y*58, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
		dxDrawText("EXP: "..EXP.." / 20", x*1380, y*328, x*1072, y*58, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
		dxDrawText(desemp, x*1380, y*380, x*1072, y*58, tocolor(255, 255, 255, 255), x*1.00, "default", "center", "center", false, false, false, false, false)
end
addEventHandler("onClientRender", root, HUDc)

function toggleRadar()
	if isVisible then
		addEventHandler("onClientRender", root, HUDc)
	else
		removeEventHandler("onClientRender", root, HUDc)
	end
	isVisible = not isVisible
end
bindKey ("F11", "down", toggleRadar)

function renderDxHud()
	addEventHandler("onClientRender", getRootElement(), HUDc)
	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()), renderDxHud)

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 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
		
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

https://i.imgur.com/3DNGVmP.png

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...