View Single Post
01/19/18, 07:36 PM   #6
Rhyono
AddOn Author - Click to view addons
Join Date: Sep 2016
Posts: 659
I don't know what I'm doing wrong: check for addon load, register player activated, when player activates, it should call the house test, which grabs the zone ID and if the ID is greater than 0, it knows it is a house. So then it checks if I own the house. There are chat messages for all of them and I included a variable just to see. It isn't triggering. So now I feel that I've likely made some dumb, obvious mistake that is breaking it:

lua Code:
  1. local Test = {
  2. name = "Test",
  3. author = "Rhyono",
  4. version = 1}
  5.  
  6. local function OnAddOnLoaded(event, addonName)
  7.     if addonName == Test.name then
  8.         d("Loaded.")
  9.         EVENT_MANAGER:RegisterForEvent(Test.name,EVENT_PLAYER_ACTIVATED,Test.HouseTest)
  10.         EVENT_MANAGER:UnregisterForEvent(Test.name, EVENT_ADD_ON_LOADED)
  11.     end
  12. end
  13.  
  14. function Test.HouseTest()
  15.     d("Function called.")
  16.     if GetCurrentZoneHouseId() > 0 then
  17.         if IsOwnerOfCurrentHouse() then
  18.             d("My house.")
  19.             myHouse = true
  20.         else
  21.             d("Not my house.")
  22.             myHouse = false
  23.     else
  24.         d("Not a house.")
  25.         myHouse = false
  26.     end
  27. end
  28.  
  29. EVENT_MANAGER:RegisterForEvent(Test.name, EVENT_ADD_ON_LOADED, OnAddOnLoaded)
  Reply With Quote