Faction from GetPlayerInfoByGUID()
View Single Post
12-01-12, 01:55 AM
Join Date: Mar 2006
Can't you use ChatFrame_AddMessageEventFilter and just catch the language argument (arg3) passed with the chat message? I can't recall the last time I saw anyone /say or /yell anything in a language other than their faction's default language, so just checking for Orcish or Common should catch 99% of cases.
Another option would be to do what BadBoy_Levels does to check levels, and attempt to add the player to your friends list and catch the result message. If it's successful, the player is part of your faction; if it failed, the player is of the opposing faction. This wouldn't work for cross-realm players, but I think the chances of someone of the opposite faction from another server /saying or /yelling anything in a non-default language are pretty slim.
Finally, SendAddonMessage doesn't need a return value, as it's trivial to catch the message printed to the chat frame when sending fails, and hide it from the user.
Troubleshoot an addon
Turn any code into an addon
More addon resources
Need help with your code?
code! Attach or
Please don’t PM me
about addon bugs or code questions. Post a comment or forum thread instead!
Last edited by Phanx : 12-01-12 at
View Public Profile
Send a private message to Phanx
Find More Posts by Phanx