• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Addon Help

Status
Not open for further replies.

Rochet2

Moderator / Eluna Dev
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:
Code:
-- 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
        end
    end
end

local MsgReceiver = CreateFrame("Frame")
MsgReceiver:RegisterEvent("CHAT_MSG_ADDON")
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:
https://github.com/ElunaLuaEngine/Eluna/blob/master/PlayerMethods.h#L2059

And the account ID can be got with player->GetSession()->GetAccountId() as seen here
https://github.com/ElunaLuaEngine/Eluna/blob/master/PlayerMethods.h#L942
 
Status
Not open for further replies.
Top