Originally Posted by haste
Another thing you should do is to remove the if(unit == 'target' or unit == 'player') part of your code.
|
thanks now it works !
i have the if(unit == target or unit == player) part because,i have another text for targettarget, pet, focus
thats the whole function:
Code:
local function PostUpdateHealth(self, event, unit, bar, min, max)
if(self.unit ~= unit) then return end
local min, max = UnitHealth(unit), UnitHealthMax(unit)
local bar = self.Health
local d = floor(min/max*100)
if(not UnitIsConnected(unit)) then
bar.Text:SetText('Offline')
elseif(UnitIsDead(unit)) then
bar.Text:SetText('Dead')
elseif(UnitIsGhost(unit)) then
bar.Text:SetText('Ghost')
else
if (unit == 'target') then
if (targetshort == true) then
bar.Text:SetText(ShortHp(min))
else
bar.Text:SetText(min)
end
else
if(min ~= max) then
bar.Text:SetText(min)
else
if (UnitMana("player") > 0) then
bar.Text:SetText(min)
elseif (UnitMana("player") == 0) then
bar.Text:SetText()
elseif(UnitAffectingCombat("player") == 1) then
bar.Text:SetText(min)
else
bar.Text:SetText()
end
end
end
end
end
if(not UnitIsConnected(unit) or UnitIsDead(unit) or UnitIsGhost(unit)) then
bar.Text2:SetText()
else
if (unit == 'target') then
if (min ~= max) then
bar.Text2:SetText(d.."%")
else
bar.Text2:SetText()
end
else
if(min ~= max) then
if(d < 100) then
bar.Text2:SetText(d.."%")
end
else
bar.Text2:SetText()
end
end
end
end
ok i could delete the if (unit == target or unit == player) part and hide this text in the layout.