Jump to content

[AJUDA] Erro format da hud


Recommended Posts

Achei essa HUD tipo FiveM da famosa internet so que ela ta com erro que fica floodando o debug o tempo todo sem parar, ja tentei resolver mas toda vez que mexo algum da linha do script acabar nao pegando mas.

http://prntscr.com/llicf8

 

local screenW,screenH = guiGetScreenSize()
local resW, resH = 1280, 720
local x, y =  (screenW/resW), (screenH/resH)

function HudGtaV ( )
--dxDrawImage( x*1093, y*118, x*111, y*82, "img/"..getPedWeapon(getLocalPlayer())..".png", 0, 0, 0, tocolor(255, 255, 255, 255), false)

 --       dxDrawLine( x*1100 - 1, y*79 - 1, x*1100 - 1, y*105, tocolor(21, 168, 38, 126), 1, false)
 --       dxDrawLine( x*1228, y*79 - 1, x*1100 - 1, y*79 - 1, tocolor(21, 168, 38, 126), 1, false)
 --       dxDrawLine( x*1100 - 1, y*105, x*1228, y*105, tocolor(21, 168, 38, 126), 1, false)
 --       dxDrawLine( x*1228, y*105, x*1228, y*79 - 1, tocolor(21, 168, 38, 126), 1, false)
        dxDrawRectangle( x*1100, y*79, x*128, y*26, tocolor(0, 0, 0, 126), false)
		 dxDrawImage( x*1063, y*73, x*32, y*33, "imgs/bancoo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)

local money2 = string.format("%8d",getElementData(getLocalPlayer(),"bankbalance"))
dxDrawText(""..money2, x*1105, y*77, x*1119, y*95, tocolor(150, 140, 147, 229), 1.00, "pricedown", "left", "top", false, false, false, false, false)

--showammo1 = getPedAmmoInClip (localPlayer,getPedWeaponSlot(localPlayer))
--showammo2 = getPedTotalAmmo(localPlayer)-getPedAmmoInClip(localPlayer)
--dxDrawText("".. showammo1, x*1146, y*100, x*1186, y*140, tocolor(129, 137, 243, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false)
--dxDrawText("".. showammo2, x*1197, y*99, x*1237, y*139, tocolor(12, 20, 127, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false)

local altura = 25
local imageL, imageA = 25,25
local star01, star02, star03, star04, star05, star06 = 1220, 1193, 1165, 1138, 1110, 1080
local image = "wanted/star.png"
wanted = getPlayerWantedLevel (getLocalPlayer())

	if wanted == 1 then
	dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01
	dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 02 --fundo
	dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 03 --fundo
	dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 04 --fundo
	dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 05 --fundo
	dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 06 --fundo
	end
	if wanted == 2 then
	dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01
	dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image) -- star 02
	dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 03 --fundo
	dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 04 --fundo
	dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 05 --fundo
	dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 06 --fundo
	end

	if wanted == 3 then
	dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01
	dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image) -- star 02
	dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image) -- star 03
	dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 04 --fundo
	dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 05 --fundo
	dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 06 --fundo
 
	end
	
	if wanted == 4 then
	dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01
	dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image) -- star 02
	dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image) -- star 03
	dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image) -- star 04
	dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 05 --fundo
	dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 06 --fundo
	end

	if wanted == 5 then
	dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01
	dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image) -- star 02
	dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image) -- star 03
	dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image) -- star 04
	dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image) -- star 05
	dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 06 --fundo
	end
	if wanted == 6 then 
	dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01
	dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image) -- star 02
	dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image) -- star 03
	dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image) -- star 04
	dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image) -- star 05
	dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image) -- star 06
	end

--------------------------------------------
end

 

Quote

 

 

Link to comment
  • Other Languages Moderators

Ele está reclamando que não é possível usar string.format, pois aquele valor é false. (o jogador não tem nenhuma data "bankbalance")

Coloque uma condição antes dessa formatação, de modo que se a data não existir, ele faça a conversão usando outro valor.

local screenW,screenH = guiGetScreenSize()
local resW, resH = 1280, 720
local x, y =  (screenW/resW), (screenH/resH)

function HudGtaV ()
	-- dxDrawImage( x*1093, y*118, x*111, y*82, "img/"..getPedWeapon(getLocalPlayer())..".png", 0, 0, 0, tocolor(255, 255, 255, 255), false)

	-- dxDrawLine( x*1100 - 1, y*79 - 1, x*1100 - 1, y*105, tocolor(21, 168, 38, 126), 1, false)
	-- dxDrawLine( x*1228, y*79 - 1, x*1100 - 1, y*79 - 1, tocolor(21, 168, 38, 126), 1, false)
	-- dxDrawLine( x*1100 - 1, y*105, x*1228, y*105, tocolor(21, 168, 38, 126), 1, false)
	-- dxDrawLine( x*1228, y*105, x*1228, y*79 - 1, tocolor(21, 168, 38, 126), 1, false)
	dxDrawRectangle( x*1100, y*79, x*128, y*26, tocolor(0, 0, 0, 126), false)
	dxDrawImage( x*1063, y*73, x*32, y*33, "imgs/bancoo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
	local money2 = 0
	if getElementData(getLocalPlayer(),"bankbalance") then
		money2 = string.format("%8d", getElementData (getLocalPlayer(),"bankbalance"))
	else
		money2 = string.format("%8d", 0)
	end
	dxDrawText(""..money2, x*1105, y*77, x*1119, y*95, tocolor(150, 140, 147, 229), 1.00, "pricedown", "left", "top", false, false, false, false, false)
	
	-- showammo1 = getPedAmmoInClip (localPlayer,getPedWeaponSlot(localPlayer))
	-- showammo2 = getPedTotalAmmo(localPlayer)-getPedAmmoInClip(localPlayer)
	-- dxDrawText("".. showammo1, x*1146, y*100, x*1186, y*140, tocolor(129, 137, 243, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false)
	-- dxDrawText("".. showammo2, x*1197, y*99, x*1237, y*139, tocolor(12, 20, 127, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false)

	local altura = 25
	local imageL, imageA = 25,25
	local star01, star02, star03, star04, star05, star06 = 1220, 1193, 1165, 1138, 1110, 1080
	local image = "wanted/star.png"
	wanted = getPlayerWantedLevel (getLocalPlayer())
	
	if wanted == 1 then
		dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01
		dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 02 --fundo
		dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 03 --fundo
		dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 04 --fundo
		dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 05 --fundo
		dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 06 --fundo
	elseif wanted == 2 then
		dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01
		dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image) -- star 02
		dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 03 --fundo
		dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 04 --fundo
		dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 05 --fundo
		dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 06 --fundo
	elseif wanted == 3 then
		dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01
		dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image) -- star 02
		dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image) -- star 03
		dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 04 --fundo
		dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 05 --fundo
		dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 06 --fundo
	elseif wanted == 4 then
		dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01
		dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image) -- star 02
		dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image) -- star 03
		dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image) -- star 04
		dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 05 --fundo
		dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 06 --fundo
	elseif wanted == 5 then
		dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01
		dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image) -- star 02
		dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image) -- star 03
		dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image) -- star 04
		dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image) -- star 05
		dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 06 --fundo
	elseif wanted == 6 then 
		dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01
		dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image) -- star 02
		dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image) -- star 03
		dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image) -- star 04
		dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image) -- star 05
		dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image) -- star 06
	end
end

Também corrigi a indentação e algumas condições.

Edited by Lord Henry
  • Thanks 1
Link to comment
21 minutes ago, Lord Henry said:

Ele está reclamando que não é possível usar string.format, pois aquele valor é false. (o jogador não tem nenhuma data "bankbalance")

Coloque uma condição antes dessa formatação, de modo que se a data não existir, ele faça a conversão usando outro valor.


local screenW,screenH = guiGetScreenSize()local resW, resH = 1280, 720local x, y =  (screenW/resW), (screenH/resH)function HudGtaV ()	-- dxDrawImage( x*1093, y*118, x*111, y*82, "img/"..getPedWeapon(getLocalPlayer())..".png", 0, 0, 0, tocolor(255, 255, 255, 255), false)	-- dxDrawLine( x*1100 - 1, y*79 - 1, x*1100 - 1, y*105, tocolor(21, 168, 38, 126), 1, false)	-- dxDrawLine( x*1228, y*79 - 1, x*1100 - 1, y*79 - 1, tocolor(21, 168, 38, 126), 1, false)	-- dxDrawLine( x*1100 - 1, y*105, x*1228, y*105, tocolor(21, 168, 38, 126), 1, false)	-- dxDrawLine( x*1228, y*105, x*1228, y*79 - 1, tocolor(21, 168, 38, 126), 1, false)	dxDrawRectangle( x*1100, y*79, x*128, y*26, tocolor(0, 0, 0, 126), false)	dxDrawImage( x*1063, y*73, x*32, y*33, "imgs/bancoo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)	local money2 = 0	if getElementData(getLocalPlayer(),"bankbalance") then		money2 = string.format("%8d", getElementData (getLocalPlayer(),"bankbalance"))	else		money2 = string.format("%8d", 0)	end	dxDrawText(""..money2, x*1105, y*77, x*1119, y*95, tocolor(150, 140, 147, 229), 1.00, "pricedown", "left", "top", false, false, false, false, false)		-- showammo1 = getPedAmmoInClip (localPlayer,getPedWeaponSlot(localPlayer))	-- showammo2 = getPedTotalAmmo(localPlayer)-getPedAmmoInClip(localPlayer)	-- dxDrawText("".. showammo1, x*1146, y*100, x*1186, y*140, tocolor(129, 137, 243, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false)	-- dxDrawText("".. showammo2, x*1197, y*99, x*1237, y*139, tocolor(12, 20, 127, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false)	local altura = 25	local imageL, imageA = 25,25	local star01, star02, star03, star04, star05, star06 = 1220, 1193, 1165, 1138, 1110, 1080	local image = "wanted/star.png"	wanted = getPlayerWantedLevel (getLocalPlayer())		if wanted == 1 then		dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01		dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 02 --fundo		dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 03 --fundo		dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 04 --fundo		dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 05 --fundo		dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 06 --fundo	elseif wanted == 2 then		dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01		dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image) -- star 02		dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 03 --fundo		dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 04 --fundo		dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 05 --fundo		dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 06 --fundo	elseif wanted == 3 then		dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01		dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image) -- star 02		dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image) -- star 03		dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 04 --fundo		dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 05 --fundo		dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 06 --fundo	elseif wanted == 4 then		dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01		dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image) -- star 02		dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image) -- star 03		dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image) -- star 04		dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 05 --fundo		dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 06 --fundo	elseif wanted == 5 then		dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01		dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image) -- star 02		dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image) -- star 03		dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image) -- star 04		dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image) -- star 05		dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image, 0,0,0, tocolor(0, 0, 0, 150)) -- star 06 --fundo	elseif wanted == 6 then 		dxDrawImage(x*star01, y*altura, x*imageL, y*imageA, image) -- star 01		dxDrawImage(x*star02, y*altura, x*imageL, y*imageA, image) -- star 02		dxDrawImage(x*star03, y*altura, x*imageL, y*imageA, image) -- star 03		dxDrawImage(x*star04, y*altura, x*imageL, y*imageA, image) -- star 04		dxDrawImage(x*star05, y*altura, x*imageL, y*imageA, image) -- star 05		dxDrawImage(x*star06, y*altura, x*imageL, y*imageA, image) -- star 06	endend

Também corrigi a indentação e algumas condições.

Funciono perfeitamente sem erros muito obrigado como sempre rsrs
 

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