Code:
local frame = CreateFrame("frame")
frame:RegisterEvent("PLAYER_REGEN_ENABLED")
frame:RegisterEvent("PLAYER_REGEN_DISABLED")
frame:RegisterEvent("PLAYER_LOGIN")
frame:RegisterEvent("UNIT_POWER")
local function HideAndShow(self, event, ...)
local unitId, resource = ...
local class, classFileName = UnitClass("player")
if unitId == "player" and resource == "MANA" and classFileName == "SHAMAN" then
print("ABC")
for i = 1, 4 do
local haveTotem, name = GetTotemInfo(i)
for o = 1,4 do
local frame = getglobal("XiTimers_Timer"..o)
if event == "UNIT_POWER" and name == "" and event == "PLAYER_REGEN_DISABLED" then
frame:Show()
else
frame:Hide()
end
end
end
end
end
frame:SetScript("OnEvent", HideAndShow)
Okay, this does not work. Can you help me here? Please :P
There is something wrong with that code, and I'm too tired to find the error.