Jump to content

Recommended Posts

  • Premium
49 minutes ago, gweilo321 said:

Hi guys im looking for a function in c++ source to get players name.

I tried "


 if((chrGetName)== "name")

" but its not working, anyone got an idea whats the function?

if (ch->GetName() == "something")



This is probably what it should look like

Link to comment
https://metin2.dev/topic/19935-looking-for-a-function/#findComment-108306
Share on other sites

Theres no char.h as i am doing this in a client source. In

InstanceBaseEffect.cpp

 

and i am changing this code

void CInstanceBase::UpdateTextTailLevel(DWORD level)

to this

void CInstanceBase::UpdateTextTailLevel(DWORD level)
{
	static D3DXCOLOR s_kLevelColor = D3DXCOLOR(152.0f/255.0f, 255.0f/255.0f, 51.0f/255.0f, 1.0f);

	char szText[256];
	sprintf(szText, "Lv %d", level);
	CPythonTextTail::Instance().AttachLevel(GetVirtualID(), szText, s_kLevelColor);

	if (IsGameMaster()) //GM
	{
		sprintf(szText, "|cff87CEEB[DEV]|r Lv %d ", level);
		CPythonTextTail::Instance().AttachLevel(GetVirtualID(), szText, s_kLevelColor);
	}
}

 

But instead of isGameMaster i wanna change it to check ingame nickname.

so i basically want something like this

    if (ch->GetName() == "Name")
    {
        sprintf(szText, "|cff87CEEB[DEV]|r Lv %d ", level);
        CPythonTextTail::Instance().AttachLevel(GetVirtualID(), szText, s_kLevelColor);
    }

but its not working, has anyone got an idea how can i do it?

Link to comment
https://metin2.dev/topic/19935-looking-for-a-function/#findComment-108460
Share on other sites

  • Premium

I leave you here an example of how i did what you pretend:

 

void CInstanceBase::UpdateTextTailLevel (DWORD level)
{
	static D3DXCOLOR s_kLevelColor = D3DXCOLOR (152.0f / 255.0f, 255.0f / 255.0f, 51.0f / 255.0f, 1.0f);
	static D3DXCOLOR s_Red = D3DXCOLOR (0xFFFF0000);
	char szText[256];
	if (!strcmp (GetNameString(), "[Tierri]")) {
		sprintf (szText, "[Mr.Vector] ");
		CPythonTextTail::Instance().AttachLevel (GetVirtualID(), szText, s_Red);
	}
	else {
		sprintf (szText, " Level %d ", level);
		CPythonTextTail::Instance().AttachLevel (GetVirtualID(), szText, s_kLevelColor);
	}
}

If character name == [Tierri], it shows:

[Mr.Vector] [Tierri]

Instead of

Level 99 [Tierri]

 

  • Love 1
Link to comment
https://metin2.dev/topic/19935-looking-for-a-function/#findComment-108502
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.