Jump to content
Phishing - Beware of identity theft... ×
  • 0

Looking for a function


gweilo321

Question

8 answers to this question

Recommended Posts

  • 0
  • 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
Share on other sites

  • 0

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
Share on other sites

  • 0
  • 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
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

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.