• 🎉 Hey there! I've just launched my brand new server voting platform — Metin2 P Servers 🚀

Not answered Colorful guild name

Member
Sep
Threads
3
51
1
0
6

AD: Mt2009 - Mobile & PC - 30 January 2026 CHECK THE PRESENTATION!

Hello. I tried to make the color of the guild name depend on the level. The file compiled without a problem, but the guild color is gold and does not change.

Here's the code:

Hidden content
You need to reply to this thread in order to see this content.
 
Solution
Code:
char.cpp:

void CHARACTER::SendGuildName(CGuild* pGuild)
{
if (NULL == pGuild) return;
DESC* desc = GetDesc();
if (NULL == desc) return;
if (m_known_guild.find(pGuild->GetID()) != m_known_guild.end()) return;

m_known_guild.insert(pGuild->GetID());
TPacketGCGuildName pack;
memset(&pack, 0x00, sizeof(pack));
pack.header = HEADER_GC_GUILD;
pack.subheader = GUILD_SUBHEADER_GC_GUILD_NAME;
pack.size = sizeof(TPacketGCGuildName);
pack.guildID = pGuild->GetID();
memcpy(pack.guildName, pGuild->GetName(), GUILD_NAME_MAX_LEN);

pack.guildLevel = pGuild->GetLevel();

desc->Packet(&pack, sizeof(pack));
}

packet.h:

typedef struct packet_guild_name_t
{
BYTE header...
Metin2Hub Bot
M2Hub Bot
Feb
Threads
66
2,381
2
1,308
113
Hello. I tried to make the color of the guild name depend on the level. The file compiled without a problem, but the guild color is gold and does not change.

Here's the code:

Hidden content
You need to reply to this thread in order to see this content.

Hello dear user,

Your post will be under surveillance by bots for the next few hours.

Forum description : Metin2 private server, Metin2 download, Metin2 support, Metin2 Forum, Metin2 Pvp Servers, Errors, Bugs, Requests, Metin2 Pvp Forum, Everything About Metin2.
 
Discord Banner

🔥 Join us on Discord! - Active chat & direct support

We invite you to join the largest Metin2 community on Discord!

Join Now!
Member Count: 
Discord Robot
HUB Bot
Announcement
Member
Sep
Threads
3
51
1
0
6
Code:
char.cpp:

void CHARACTER::SendGuildName(CGuild* pGuild)
{
if (NULL == pGuild) return;
DESC* desc = GetDesc();
if (NULL == desc) return;
if (m_known_guild.find(pGuild->GetID()) != m_known_guild.end()) return;

m_known_guild.insert(pGuild->GetID());
TPacketGCGuildName pack;
memset(&pack, 0x00, sizeof(pack));
pack.header = HEADER_GC_GUILD;
pack.subheader = GUILD_SUBHEADER_GC_GUILD_NAME;
pack.size = sizeof(TPacketGCGuildName);
pack.guildID = pGuild->GetID();
memcpy(pack.guildName, pGuild->GetName(), GUILD_NAME_MAX_LEN);

pack.guildLevel = pGuild->GetLevel();

desc->Packet(&pack, sizeof(pack));
}

packet.h:

typedef struct packet_guild_name_t
{
BYTE header;
WORD size;
BYTE subheader;
DWORD guildID;
char guildName[GUILD_NAME_MAX_LEN];

int guildLevel;

} TPacketGCGuildName;

PythonGuild.h:

struct GuildNameLevel
{
std::string name;
int level;
};

typedef std::map<DWORD, GuildNameLevel> TGuildNameMap;

void RegisterGuildName(DWORD dwID, const char * c_szName, int level);


PythonGuild.cpp:

void CPythonGuild::RegisterGuildName(DWORD dwID, const char * c_szName, int level)
{
GuildNameLevel gnr;
gnr.name = std::string(c_szName);

gnr.level = level;
m_GuildNameMap.insert(make_pair(dwID, gnr));
}

bool CPythonGuild::GetGuildName(DWORD dwID, std::string * pstrGuildName)
{
if (m_GuildNameMap.end() == m_GuildNameMap.find(dwID))
return false;

int guildLevel = m_GuildNameMap[dwID].level;

if (guildLevel >= 10)
{
*pstrGuildName = "|cffFFC125" + m_GuildNameMap[dwID].name + "|r";
}
else if (guildLevel >= 5)
{
*pstrGuildName = "|cff888888" + m_GuildNameMap[dwID].name + "|r";
}
else if (guildLevel > 0)
{
*pstrGuildName = "|cffCD661D" + m_GuildNameMap[dwID].name + "|r";
}
else
{
*pstrGuildName = m_GuildNameMap[dwID].name;
}

return true;
}

PythonNetworkStreamPhaseGame.cpp :

case GUILD_SUBHEADER_GC_GUILD_NAME:
{
DWORD dwID;
char szGuildName[GUILD_NAME_MAX_LEN + 1];
int guildLevel;

int iPacketSize = int(GuildPacket.size) - sizeof(GuildPacket);
int nItemSize = sizeof(dwID) + GUILD_NAME_MAX_LEN + sizeof(guildLevel);
assert(iPacketSize % nItemSize == 0 && "GUILD_SUBHEADER_GC_GUILD_NAME");

for (; iPacketSize > 0;)
{
if (!Recv(sizeof(dwID), &dwID))
return false;

if (!Recv(GUILD_NAME_MAX_LEN, &szGuildName))
return false;

if (!Recv(sizeof(guildLevel), &guildLevel))
return false;

szGuildName[GUILD_NAME_MAX_LEN] = 0;
CPythonGuild::Instance().RegisterGuildName(dwID, szGuildName, guildLevel);
iPacketSize -= nItemSize;
}
break;
}
 
Solution
Discord Banner

🔥 Join us on Discord! - Active chat & direct support

We invite you to join the largest Metin2 community on Discord!

Join Now!
Member Count: 
Discord Robot
HUB Bot
Announcement
Discord Banner

🔥 Join us on Discord! - Active chat & direct support

We invite you to join the largest Metin2 community on Discord!

Join Now!
Member Count: 
Discord Robot
HUB Bot
Announcement
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock