Jump to content

Barrita de Vida en boss


Hukaeshi

Recommended Posts

Hola quisiera crear un dxDrawRectangle donde me muestre cuanta vida tiene mi boss, pero el problema es que lo pongo y no me funsiona, es decir me sale es una barrita en negro pero no me muestra la vida que tiene, gra



local screenW, screenH = guiGetScreenSize()
local drawFontBoss = dxCreateFont("bossi.ttf", 10)
local maxDist = 50


    function witchNameTagNemesis()
    local bosses = getElementsByType ( "ped",getRootElement(),true )
    local Px,Py,Pz = getCameraMatrix( )
        for theKey,nemesis2 in ipairs(bosses) do
            if ( isElement( nemesis2 ) ) then
            local Zx,Zy,Zz = getElementPosition( nemesis2 )
            local zhx,zhy,zhz = getPedBonePosition( nemesis2,6 )
                if (getDistanceBetweenPoints3D( Px, Py, Pz, Zx, Zy, Zz ) < maxDist ) then
                    if ( getElementData (nemesis2, "NameTagP") == true) then
                        local sxx,syy = getScreenFromWorldPosition(zhx,zhy,zhz+0.3)
                        local currentDistance = getDistanceBetweenPoints3D(Px, Py, Pz, Zx, Zy, Zz)
                        local zombieHealth = getElementHealth(nemesis2)
                        local maxHP = exports.extra_health:getElementExtraHealth(nemesis2)
                        local currentHealth = getElementData(nemesis2, "currenthealth")
                        if sxx and getElementHealth(nemesis2) > 0 then
                        sx,sy = sxx-60,syy-10
                         dxDrawRectangle(sx-50,sy-18,260.0,25.0,tocolor(0,0,0,100),false) -- bg health
                        dxDrawText("Boss NmesiS",sx+7,sy-50,596.0,236.0,tocolor(255,0,0,255),0.80,"bankgothic","left","top",false,false,false)
						dxDrawText("Boss Health : "..math.floor(maxHP),sx-50,sy-18,200.0,25.0,tocolor(0,255,0,255),0.80, "bankgothic","left","top",false,false,false)
						dxDrawRectangle(sx+5,sy+25,131.0/maxHP,12.0,tocolor(255,0,0,200),false) -- health
					dxDrawRectangle(sx,sy,146.0,46.0,tocolor(0,0,0,0),false) --  background
					dxDrawRectangle(sx+5,sy+25,131.0,12.0,tocolor(0,0,0,100),false) -- bg health
                        end
                    end
                end
            end
        end
    end
    addEventHandler( "onClientRender", root, witchNameTagNemesis )
	
  

cias

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