Jump to content

HELP SYSTEM LIFE


NETCHK

Recommended Posts

Posted

sorry my photoshop have a error, I used Paint 3D kkk
OK I need a help to create system is life heart person, for on life full and empty, 100%

IMAGE SELECTION CUT

os7i1v.jpg  == 50% life
o8tgk1.png == 0%

local life = getElementHealt(source)

dxdrawimagesection()

-- help ?

 

Posted (edited)
1 hour ago, NETCHK said:

??

he sent you a topic for you to take a look at and for that you look at this : 

Quote

Yea, that's a bit better, but no, it's not dxDrawImage what you're looking for. You will need to use dxDrawImageSection

And Exemple :
 

addEventHandler('onClientRender', root, function()
local health = getElementHealth(localPlayer)
local myIconHeight = 120 --pixels
local vSize = myIconHeight / 100 * health
	dxDrawImageSection(400, 200, 64, 64, 0, 0, myIconHeight, vSize, 'egyedi/hp_full.png')
	dxDrawImage(400, 300, 128, 128, 'egyedi/hp_full.png')
end)

 

Edited by raynner
Posted
23 hours ago, raynner said:

he sent you a topic for you to take a look at and for that you look at this : 

And Exemple :
 


addEventHandler('onClientRender', root, function()
local health = getElementHealth(localPlayer)
local myIconHeight = 120 --pixels
local vSize = myIconHeight / 100 * health
	dxDrawImageSection(400, 200, 64, 64, 0, 0, myIconHeight, vSize, 'egyedi/hp_full.png')
	dxDrawImage(400, 300, 128, 128, 'egyedi/hp_full.png')
end)

 

Is it the same as the heart system I did in the picture?:(

Posted

I did, but there is a problem the image is too big

local hudS = {}
		--hudS.bgX, hudS.bgY = ConvertAbsoluteToRelative( 300, 20 ) -- Y position of background
		hudS.bgW, hudS.bgH = 0, 0
		hudS.fX, hudS.fY = 339, 800  -- Y position of fill
		hudS.fW, hudS.fH = 100, 190 
		
		--dxDrawImage(hudS.bgX, hudS.bgY, hudS.bgW, hudS.bgH, myTexture["144"])
		local currHeight = hudS.fH / 100 * getElementHealth(localPlayer) 
		dxDrawImageSection(hudS.fX, hudS.fY, hudS.fW-, currHeight, hudS.bgW, hudS.bgH, hudS.fW, currHeight, "heart.png")

 

Posted (edited)

I think it should work!

local hudS = {}
--hudS.bgX, hudS.bgY = ConvertAbsoluteToRelative( 300, 20 ) -- Y position of background
hudS.bgW, hudS.bgH = 0, 0
hudS.fX, hudS.fY = 339, 800  -- Y position of fill
hudS.fW, hudS.fH = 100, 190 
		
--dxDrawImage(hudS.bgX, hudS.bgY, hudS.bgW, hudS.bgH, myTexture["144"])
local currHeight = hudS.fH / 100 * getElementHealth(localPlayer) 
dxDrawImageSection(hudS.fX, hudS.fY + (hudS.fH - currHeight), hudS.fW-, currHeight, 0, currHeight, hudS.fW, currHeight, "heart.png", 0, 0, 0, tocolor(255,255,255,255), true)

 

Edited by raynner
Posted
46 minutes ago, raynner said:

acho que deve funcionar !
 


local hudS = {}
--hudS.bgX, hudS.bgY = ConvertAbsoluteToRelative( 300, 20 ) -- Y position of background
hudS.bgW, hudS.bgH = 0, 0
hudS.fX, hudS.fY = 339, 800  -- Y position of fill
hudS.fW, hudS.fH = 100, 190 
		
--dxDrawImage(hudS.bgX, hudS.bgY, hudS.bgW, hudS.bgH, myTexture["144"])
local currHeight = hudS.fH / 100 * getElementHealth(localPlayer) 
dxDrawImageSection(hudS.fX, hudS.fY + (hudS.fH - currHeight), hudS.fW-, currHeight, 0, currHeight, hudS.fW, currHeight, "heart.png", 0, 0, 0, tocolor(255,255,255,255), true)

 

not

Posted

Type /debugscript 3 and make sure there's no errors with your code.

Also, please show your code here so we can see what's wrong.
 

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