View Single Post
09/29/19, 05:13 AM   #1
Shawn5150
 
Shawn5150's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2019
Posts: 2
Blocking Chat messages

Hello, I'm writing a simple Addon that block Zone Message everywhere except Cyrodiil/Craglorn. The test chat message display I've inserted in the Addon works correctly, the only thing missing is I can't find a way to block chat message from displaying. I've checked the wiki for events/functions but I can't find a way to block them. How should I block chat messages from displaying ?

Here is the code I've written so far.

Lua Code:
  1. ZonePug = {}
  2. ZonePug.name = "ZonePug"
  3.  
  4. function ZonePug.OnInitialized(eventCode, addOnName)
  5.     if (ZonePug.name ~= addOnName) then return end
  6.     EVENT_MANAGER:RegisterForEvent(ZonePug.name, EVENT_CHAT_MESSAGE_CHANNEL, ZonePug.OnChatMessage)
  7. end
  8.  
  9. function ZonePug.OnChatMessage(eventCode, messageType, fromName, text, isFromCustomerService)
  10.     if messageType == CHAT_CHANNEL_ZONE then
  11.         if GetCurrentMapZoneIndex() == 499 or GetCurrentMapZoneIndex() == 37 then
  12.             df("%s has detected a zone message in Craglorn/Cyrodiil, let it display", ZonePug.name)
  13.         else
  14.             df("%s has detected a zone message elsewhere, block it", ZonePug.name)
  15.             -- Insert block code
  16.         end
  17.     else
  18.         df("%s has detected a non zone message, do nothing", ZonePug.name)
  19.     end
  20. end
  21.  
  22. EVENT_MANAGER:RegisterForEvent(ZonePug.name, EVENT_ADD_ON_LOADED, ZonePug.OnInitialized)
  Reply With Quote