Jump to content

Hyperlink to chat with global chat


Recommended Posts

Hi all! Thanks a lot for your tutorials, i love this forum.

Anyway here my problem:

 

I'm using files with global chat and it uses this code:

 

#ifdef ENABLE_CHAT_COLOR_SYSTEM
	// static const char* colorbuf[] = {" |h|r[寔햇?|cFFffa200|h", " |h|r[遁鞍?|cFFff0000|h", " |h|r[讀安?|cFFffc700|h", " |h|r[警仰]|cFF000bff|h"}; // Arab
	static const char* colorbuf[] = {"|cFFffa200|H|h[Staff]|h|r", "|cFFff0000|H|h[Shinsoo]|h|r", "|cFFffc700|H|h[Chunjo]|h|r", "|cFF000bff|H|h[Jinno]|h|r"};
	int len = snprintf(chatbuf, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);
#else
	int len = snprintf(chatbuf, sizeof(chatbuf), "%s : %s", ch->GetName(), buf);
#endif

 

and it works good, but I want to add the hyperlink click on nickname to PM, and I tried in this way:

 

#ifdef ENABLE_CHAT_COLOR_SYSTEM
	// static const char* colorbuf[] = {" |h|r[寔햇?|cFFffa200|h", " |h|r[遁鞍?|cFFff0000|h", " |h|r[讀安?|cFFffc700|h", " |h|r[警仰]|cFF000bff|h"}; // Arab
	static const char* colorbuf[] = {"|cFFffa200|H|h[Staff]|h|r", "|cFFff0000|H|h[Shinsoo]|h|r", "|cFFffc700|H|h[Chunjo]|h|r", "|cFF000bff|H|h[Jinno]|h|r"};
    int len;
    if (pinfo->type == CHAT_TYPE_SHOUT)
    {
        len = snprintf(chatbuf, sizeof(chatbuf), "|Hmsg:%s|h%s|h|r : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);
    }
    else
    {
        len = snprintf(chatbuf, sizeof(chatbuf), "%s : %s", ch->GetName(), buf);
    }
#endif

 

but this doesn't work, what I did wrong? (if I use the "hyperlink to chat" without global chat then works).

 

------------------------- EDIT

 

Ok, i think this is the problem:

 

len = snprintf(chatbuf, sizeof(chatbuf), "|Hmsg:%s|h%s|h|r : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);

 

Should I add an %s here?

 

"|Hmsg:%s|h%s|h|r : %s"

 

but where? °L° and how?

 

--------------------------- EDIT 

 

Ok solved, I just added an %s, i'm so idiot. Topic can be closed.

Edited by Aioria
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.