Jump to content
  • 0

Hyperlink to chat with global chat


Aioria

Question

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 post

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



Shoutbox

Shoutbox

Chatroom Rules

 

Join our Discord

A request for help = Shoutbox Ban

Be respectful & Respect the rules

 

×
×
  • 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.