Jump to content

[AJUDA] Círculo com o topo "reto"


Recommended Posts

18 minutes ago, raynner said:

se bem me lembro dxDrawImageSection faz oque você quer 

Muito obrigado cara! Tu é o cara

26 minutes ago, raynner said:

se bem me lembro dxDrawImageSection faz oque você quer 

Realmente com o image section da, mas como eu posso calcular pra fzer como na foto? pode me ajudar novamente? kkk

por exemplo calcular a vida do player

vida = getElementHealth(localPlayer)

Eu tentei usar 

34/100*vida

(34 é o tamanho da imagem), mas a imagem só ficou esticada ;-;

Link to comment
2 hours ago, Lord Henry said:

34*(vida/100)

 

Se a vida do player estiver em 100, fica normal, no lugar certo, mas se o player perde vida o círculo vai subindo :/ 

 

plvLFb1.png                        lmTHkzZ.png

 

Meu código:

 

local vida = getElementHealth(localPlayer)

dxDrawImageSection(1138, 102, 34, 34*(vida/100), 0, 0, 34, 34*(vida/100), 'files/img/health.png', 180, 0, 0, tocolor(255, 255, 255, 255))

 

Link to comment
55 minutes ago, Lord Henry said:

Não era pra colocar no 4 parâmetro.

;-; Mesmo assim ficou errado, ficou esticado dos lados

Sxk1FDF.png

 

local vida = getElementHealth(localPlayer)

dxDrawImageSection(1138, 102, 34, 34, 0, 0, 34, 34*(vida/100), 'files/img/health.png', 180, 0, 0, tocolor(255, 255, 255, 255))

 

Link to comment
function _dxDrawImageSection(x,y,w,h,x1,y1,x2,y2,img,rx,ry,rz,r,g,b,a,postGUI,percent)
	local y1 = y1 + y2*percent
	local y2 = y2 - y2*percent
	local y = y + h*percent
	local h = h - h*percent
    dxDrawImageSection(x,y,w,h,x1,y1,x2,y2,img,rx,ry,rz,tocolor(r,g,b,a),postGUI)
end

exemplo:

local nitro = getVehicleNitroLevel(vehicle)
		if nitro ~= false and nitro ~= nil and nitro > 0 then
			_dxDrawImageSection(sX-sY*0.12,sY*0.935-sY*0.045,sY*0.04,sY*0.04,0,0,256,256,"img/nitro.png",0,0,0,99,150,255,alpha,false,1-nitro)
		end

espero ter ajudado é nois jovem!!

Link to comment
11 hours ago, Gw8 said:

function _dxDrawImageSection(x,y,w,h,x1,y1,x2,y2,img,rx,ry,rz,r,g,b,a,postGUI,percent)
	local y1 = y1 + y2*percent
	local y2 = y2 - y2*percent
	local y = y + h*percent
	local h = h - h*percent
    dxDrawImageSection(x,y,w,h,x1,y1,x2,y2,img,rx,ry,rz,tocolor(r,g,b,a),postGUI)
end

exemplo:


local nitro = getVehicleNitroLevel(vehicle)
		if nitro ~= false and nitro ~= nil and nitro > 0 then
			_dxDrawImageSection(sX-sY*0.12,sY*0.935-sY*0.045,sY*0.04,sY*0.04,0,0,256,256,"img/nitro.png",0,0,0,99,150,255,alpha,false,1-nitro)
		end

espero ter ajudado é nois jovem!!

 

Aqui ficou com um monte de círculos ;-;

 

meu código:

_dxDrawImageSection(1138, 102, 34,34,0,0,34,34,"files/img/health.png",0,0,0,99,150,255,255,false,vida)

E coloquei a função _dxDrawImageSection no código tb, mas ficou assim:

 

CYd0rpW.png

Link to comment
1 hour ago, Gw8 said:

me mostra a parte do seu codigo ai

o progesso ta errado por isso ta doidao assim kkk

testa isso

local vida= math.min(getElementHealth(localPlayer)/1000,1)

Opa, agora deu certo! ^^ Eu usei: 

local vida = math.min(getElementHealth(localPlayer)/100,1)

e usei:

_dxDrawImageSection(1138, 102, 34,34,0,0,34,34,"files/img/health.png",0,0,0,99,150,255,255,false,1-vida)

Mt obrigado Gw8! :D

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