Jump to content

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


Recommended Posts

Posted

Eae galera, to com uma dúvida aqui, como que eu faço pra deixar um dxCircle com o topo reto? ou usando um shader.fx? :s

 

Exemplo:

 

nbr8wIJ.png

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

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

 

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

 

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

Posted
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

Posted (edited)

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)

Edited by Gw8
  • Thanks 1
Posted
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

Posted

rs eu odeio usar essa função ela é muito complexa em minha mente eu também tenho problemas em fazer esses cálculos felizmente outro membro já te ajudou eu me dou bem com todos os outros elementos dx menos ImageSection rs

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