View Full Version : Addon Help

Lightning Blade
05-15-2014, 02:41 PM
I was wondering how I would with or without Eluna get the players account name with my addon.

05-15-2014, 03:09 PM
You need to send the account name to the client from core.
What you need that info for on the client : |?

Anyways, here is an example of how to do it with eluna:

-- Addon:
local function ONADDONMSG(self, event, prefix, msg, Type, sender)
if (event == "CHAT_MSG_ADDON" and prefix == "Your Prefix") then
if(sender == UnitName("player")) then -- Only accept the player's own addon messages
print(msg) -- prints the account name

local MsgReceiver = CreateFrame("Frame")
MsgReceiver:SetScript("OnEvent", ONADDONMSG)

-- Eluna:
local msg = tostring(player:GetAccountId())
player:SendAddonMessage("Your Prefix", msg, 7, player)

If you want to do it with C++, you can see the lua method coded here:

And the account ID can be got with player->GetSession()->GetAccountId() as seen here

Lightning Blade
05-15-2014, 03:17 PM
How do I active this, Kind of confused.

Lightning Blade
05-15-2014, 07:58 PM
Mark as solved

05-15-2014, 11:59 PM
Mark as solved

You don't have to reply "Mark as solved". It will be marked as solved once you reply with "Thanks, it works now!", or something that doesn't sound condescending.