Thank you so much ! It seems to have done the trick.
For anyone curious, here is the new code :
Lua Code:
ZonePug = {}
ZonePug.name = "ZonePug"
function ZonePug.OnInitialized(eventCode, addOnName)
if (ZonePug.name ~= addOnName) then return end
ZO_PreHook(CHAT_SYSTEM, "OnChatEvent", ZonePug.OnChatMessage)
end
function ZonePug.OnChatMessage(eventCode, messageType, fromName, text, isFromCustomerService)
if fromName == CHAT_CHANNEL_ZONE then
if GetCurrentMapZoneIndex() == 499 or GetCurrentMapZoneIndex() == 37 then
-- df("%s has detected a zone message in Craglorn/Cyrodiil, let it display", ZonePug.name)
else
-- df("%s has detected a zone message elsewhere, block it", ZonePug.name)
return true
end
else
-- df("%s has detected a non zone message, do nothing", ZonePug.name)
end
end
EVENT_MANAGER:RegisterForEvent(ZonePug.name, EVENT_ADD_ON_LOADED, ZonePug.OnInitialized)