Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local hideFrame = CreateFrame("FRAME")
- local function PEW_EventHandler(self, event, ...)
- --when you LogIn or use /reload
- if(event == "PLAYER_ENTERING_WORLD") then
- --Make the PlayerFrame invisible at the start
- Stuf.units.player:SetAlpha(0);
- --when you mouseover the PlayerFrame
- Stuf.units.player:HookScript("OnEnter", function(self)
- self:SetAlpha(1);
- end);
- --when you stop mouseover the PlayerFrame
- Stuf.units.player:HookScript("OnLeave", function(self)
- if(not InCombatLockdown() and not UnitExists("target")) then
- self:SetAlpha(0);
- end
- end);
- --gets out-of-combat
- elseif(event == "PLAYER_REGEN_ENABLED") then
- Stuf.units.player:SetAlpha(0);
- --enters in combat
- elseif(event == "PLAYER_REGEN_DISABLED") then
- Stuf.units.player:SetAlpha(1);
- --target changes
- elseif(event == "PLAYER_TARGET_CHANGED") then
- if(not InCombatLockdown()) then
- if(UnitExists("target")) then
- Stuf.units.player:SetAlpha(1);
- else
- Stuf.units.player:SetAlpha(0);
- end
- end
- end
- end
- hideFrame:SetScript("OnEvent", PEW_EventHandler)
- hideFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
- hideFrame:RegisterEvent("PLAYER_REGEN_ENABLED");
- hideFrame:RegisterEvent("PLAYER_REGEN_DISABLED");
- hideFrame:RegisterEvent("PLAYER_TARGET_CHANGED");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement