Jump to content

Global Chat


Recommended Posts

int len_global_ snprintf(chatbuf_global,  .........................

change with

		int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s %s",kingdoms[ch->GetEmpire()-1], chatbuf);
Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
  • Love 1
Link to comment
Share on other sites

  • 2 months later...
  • 3 weeks later...
  • Former Staff

thx :)

 

this code for the one who can't write all that code

	const char* kingdoms[3] = {"|cFFff000|h|h[Shinsoo]|cFFA7FFD4|H|h","|CFFFFFF00|H|h[Chunjo]|cFFA7FFD4|H|h","|cFF0080FF|H|h[Jinno]|cFFA7FFD4|H|h"};
        char chatbuf_global[CHAT_MAX_LEN + 1];
        int len_global_ = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s %s",kingdoms[ch->GetEmpire()-1], chatbuf);
 
        TPacketGGShout p;
 
        p.bHeader = HEADER_GG_SHOUT;
        p.bEmpire = ch->GetEmpire();
        strlcpy(p.szText, chatbuf_global, sizeof(p.szText));
 
        P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGShout));
 
        SendShout(chatbuf_global, ch->GetEmpire());
  • Love 1
Link to comment
Share on other sites

  • 2 weeks later...

For sure it is orginal code

	if (pinfo->type == CHAT_TYPE_SHOUT)
	{
		const int SHOUT_LIMIT_LEVEL = g_iUseLocale ? 15 : 3;

		if (ch->GetLevel() < SHOUT_LIMIT_LEVEL)
		{
			ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¿ÜÄ¡±â´Â ·¹º§ %d ÀÌ»ó¸¸ »ç¿ë °¡´É ÇÕ´Ï´Ù."), SHOUT_LIMIT_LEVEL);
			return (iExtraLen);
		}

		if (thecore_heart->pulse - (int) ch->GetLastShoutPulse() < passes_per_sec * 15)
			return (iExtraLen);

		ch->SetLastShoutPulse(thecore_heart->pulse);

		const char* kingdoms[3] = {"|cFFff0000|H|h[Shinsoo]|cFFa7FFD4|H|h","|cFFFFFF00|H|h[Chunjo]|cFFA7FFD4|H|h","|cFF0080FF|H|h[Jinno]|cFFA7FFD4|H|h"};
		char chatbuf_global[CHAT_MAX_LEN + 1];
		int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s %s",kingdoms[ch->GetEmpire()-1],chatbuf);
		
		TPacketGGShout p;

		p.bHeader = HEADER_GG_SHOUT;
		p.bEmpire = ch->GetEmpire();
		strlcpy(p.szText, chatbuf_global, sizeof(p.szText));
		//strlcpy(p.szText, chatbuf, sizeof(p.szText));
		P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGShout));

		SendShout(chatbuf_global, ch->GetEmpire());

		return (iExtraLen);
	}
Link to comment
Share on other sites

  • Honorable Member

I have made this myself by another way. (No need glass to make shout if empire_chat is enabled.)

 

Check my part of code to solve your problem:

	const char * ColoredEmpireNames[4] = {"0", "|cFFFF0000[Shinshoo]|r", "|cFFFFFF00[Chunjo]|r", "|cFF0080FF[Jinno]|r",};
	const char * ColoredTeamName = "|cFFFFC700[Team]|r";
	len = snprintf(chatbuf, sizeof(chatbuf), "%s %s : %s",
		ch->GetGMLevel() != GM_PLAYER ? ColoredTeamName : ColoredEmpireNames[ch->GetEmpire()], ch->GetName(), buf);

The [shinsoo] is so ugly on printscreen by client:

0504_120833.jpg

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 6
Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...

Its work me fine.

const char* kingdoms[3] = {"|cFFff000|h|h[Shinsoo]|cFFA7FFD4|H|h","|CFFFFFF00|H|h[Chunjo]|cFFA7FFD4|H|h","|cFF0080FF|H|h[Jinno]|cFFA7FFD4|H|h"};
char chatbuf_global[CHAT_MAX_LEN + 1];
int len_global_ = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s %s",kingdoms[ch->GetEmpire()-1], chatbuf);
 
TPacketGGShout p;
 
p.bHeader = HEADER_GG_SHOUT;
p.bEmpire = ch->GetEmpire();
strlcpy(p.szText, chatbuf_global, sizeof(p.szText));
 
P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGShout));
 
SendShout(chatbuf_global, ch->GetEmpire());
Link to comment
Share on other sites

  • 4 weeks later...
  • 6 years later...
  • 7 months later...

Ok. The system is good but i had an issue on 40k source. The kingdom's color are not working, only for blue kingdom.

To solve this, if you use the first post you need to change the colors i don t know really why, like those from  xP3NG3Rx.

So:

Replace this:

const char* kingdoms[3] = {"|cFFff000|h|h[Shinsoo]|cFFA7FFD4|H|h","|CFFFFFF00|H|h[Chunjo]|cFFA7FFD4|H|h","|cFF0080FF|H|h[Jinno]|cFFA7FFD4|H|h"};

With this:

const char* kingdoms[3] = {"|cFFFF0000[Shinsoo]|r", "|cFFFFFF00[Chunjo]|r", "|cFF0080FF[Jinno]|r"};

 

I checked a while, maybe it will help others. Good luck!

Edited by minigutza
Link to comment
Share on other sites

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.