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

[SOLVED] Chat Name Link

Status
Not open for further replies.

Reloac

BETA Tester
Been trying for a few hours to edit it to allow peoples names to be clicked to start to whisper, can do it via a command but wanted to edit the officer chat, all is working as intended except names not being able to be clicked, i knew about GetNameLink but it wouldn't work on this, and i have no idea ... still getting used to C++ and edits aren't really my sort, any help as to make players names linkable (to whisper) would be appreciated.

Code:
case CHAT_MSG_OFFICER:
	 {
		 char message[1024];
		 switch (GetPlayer()->GetSession()->GetSecurity())
		 {
			case SEC_PLAYER:
			snprintf(message, 1024, "|cffff0000[World Chat]|r |cffffffff[%s]: %s", GetPlayer()->GetName().c_str(), msg.c_str());
			break;

		    case SEC_TRIALGM:
			if (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM))
			{
				snprintf(message, 1024, "|cffff0000[World Chat]|r|TInterface\\ChatFrame\\UI-ChatIcon-Blizz.blp:0:2:0:-3|t|cffffffff[%s]|r: %s|r", GetPlayer()->GetName().c_str(), msg.c_str());
			}
			else
			{
				snprintf(message, 1024, "|cffff0000[World Chat]|r |cffffffff[%s]: %s", GetPlayer()->GetName().c_str(), msg.c_str());
			}break;

		    case SEC_GAMEMASTER:
			if (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM))
			{
				snprintf(message, 1024, "|cffff0000[World Chat]|r|TInterface\\ChatFrame\\UI-ChatIcon-Blizz.blp:0:2:0:-3|t|cffffffff[%s]|r: %s|r", GetPlayer()->GetName().c_str(), msg.c_str());
			}
			else
			{
				snprintf(message, 1024, "|cffff0000[World Chat]|r |cffffffff[%s]: %s", GetPlayer()->GetName().c_str(), msg.c_str());
			}break;

			case SEC_SENIORGAMEMASTER:
			if (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM))
			{
				snprintf(message, 1024, "|cffff0000[World Chat]|r|TInterface\\ChatFrame\\UI-ChatIcon-Blizz.blp:0:2:0:-3|t|cffffffff[%s]|r: %s|r", GetPlayer()->GetName().c_str(), msg.c_str());
			}
			else
			{
				snprintf(message, 1024, "|cffff0000[World Chat]|r |cffffffff[%s]: %s", GetPlayer()->GetName().c_str(), msg.c_str());
			}break;

			case SEC_HEADGAMEMASTER:
			if (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM))
			{
				snprintf(message, 1024, "|cffff0000[World Chat]|r|TInterface\\ChatFrame\\UI-ChatIcon-Blizz.blp:0:2:0:-3|t|cffffffff[%s]|r: %s|r", GetPlayer()->GetName().c_str(), msg.c_str());
			}
			else
			{
				snprintf(message, 1024, "|cffff0000[World Chat]|r |cffffffff[%s]: %s", GetPlayer()->GetName().c_str(), msg.c_str());
			}break;

			case SEC_DEVELOPER:
			if (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM))
			{
				snprintf(message, 1024, "|cffff0000[World Chat]|r|TInterface\\ChatFrame\\UI-ChatIcon-Blizz.blp:0:2:0:-3|t|cffffffff[%s]|r: %s|r", GetPlayer()->GetName().c_str(), msg.c_str());
			}
			else
			{
				snprintf(message, 1024, "|cffff0000[World Chat]|r |cffffffff[%s]: %s", GetPlayer()->GetName().c_str(), msg.c_str());
			}break;

			case SEC_ADMINISTRATOR:
			if (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM))
			{
				snprintf(message, 1024, "|cffff0000[World Chat]|r|TInterface\\ChatFrame\\UI-ChatIcon-Blizz.blp:0:2:0:-3|t|cffffffff[%s]|r: %s|r", GetPlayer()->GetName().c_str(), msg.c_str());
			}
			else
			{
				snprintf(message, 1024, "|cffff0000[World Chat]|r |cffffffff[%s]: %s", GetPlayer()->GetName().c_str(), msg.c_str());
			}break;
		}
	sWorld->SendGlobalText(message, NULL);
}break;
 

Rochet2

Moderator / Eluna Dev
According to wowwiki:
|Hplayer:Name:ChatID|hLinktext|h

ChatID is probably not WOTLK, so
|Hplayer:Name|hLinktext|h
Would be my best bet.
Linktext is obviously supposed to be the player name.

Try something like this:
Code:
case CHAT_MSG_OFFICER:
{
    std::ostringstream oss;
    oss << "|cffff0000[World Chat]|r";
    if (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM))
    {
        switch (GetPlayer()->GetSession()->GetSecurity())
        {
            default:
            oss << "|cffff0000[World Chat]|r|TInterface\\ChatFrame\\UI-ChatIcon-Blizz.blp:0:2:0:-3|t|cffffffff|Hplayer:Name|h[" << GetPlayer()->GetName() << "]|h|r: " << msg << "|r";
        }
    }
    else
        oss << "|cffff0000[World Chat]|r |cffffffff|Hplayer:Name|h[" << GetPlayer()->GetName() << "]|h: " << msg;
    
    sWorld->SendGlobalText(oss.str().c_str(), NULL);
}break;

Untested .. I actually wrote this on notepad : |
 

Reloac

BETA Tester
Thanks i tried that but kept getting Chathandler undefined, but apparently suddenly decided to work! :p
 
Status
Not open for further replies.
Top