View Single Post
12-07-14, 06:47 PM   #1
JDoubleU00
A Firelord
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 463
Question Addon to Leave a Channel if in Garrison

OK, I am endeavoring to make my first addon. I have noticed that General chat in the garrison is becoming Barens Trade chat. Here is what is suppose to do in a nutshell.

Player enters world or changes zone (no code for the latter yet), checks to see if player is in their garrison. If yes, then leave General Chat, if not join General chat. If you are in General and not in your garrison, do nothing.

Here is what I have so far:

Code:
local frame = CreateFrame("Frame")
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:SetScript("OnEvent", function(self, event, ...)
      local zoneName = GetZoneText();
      message(zoneName);
      if zoneName=="Lunarfall" then
         print("Home");
         LeaveChannelByName("General");
      else
         JoinChannelByName("General");
         print("Adding");
      end
end)
It works to the point of leaving General when entering the world or reloading. I can not get it to join General chat. Any help or pointers are appreciated.
  Reply With Quote