Jump to content

Changing position c++


Recommended Posts

Hi. I use prestige system

#if ENABLE_NEW_PRESTIGE_SYSTEM == 1
	char szNameTextTail[5000 + 1];

	if (pCharacterInstance->IsPC() && pCharacterInstance->GetPrestigeLevel())
	{
		if (pCharacterInstance->GetPrestigeLevel() < PRESTIGE_MAX)
			snprintf(szNameTextTail, sizeof(szNameTextTail), "[Prestige %d]%s", pCharacterInstance->GetPrestigeLevel(), pCharacterInstance->GetNameString());
		else
			snprintf(szNameTextTail, sizeof(szNameTextTail), "[Prestige Master]%s", pCharacterInstance->GetNameString());
	}
	else
		snprintf(szNameTextTail, sizeof(szNameTextTail), "%s", pCharacterInstance->GetNameString());

	TTextTail * pTextTail = RegisterTextTail(dwVirtualID,
		szNameTextTail,
		pCharacterInstance->GetGraphicThingInstancePtr(),
		pCharacterInstance->GetGraphicThingInstanceRef().GetHeight() + fAddHeight,
		c_rColor);

#else
	TTextTail * pTextTail = RegisterTextTail(dwVirtualID,
		pCharacterInstance->GetNameString(),
		pCharacterInstance->GetGraphicThingInstancePtr(),
		pCharacterInstance->GetGraphicThingInstanceRef().GetHeight() + fAddHeight,
		c_rColor);
#endif

It looks like 481551e6ba1a40348abbd680ed1af253.png

i want edit this to Czny. [Prestige level] 

 

How can i do it? I tried 

if (pCharacterInstance->GetPrestigeLevel() < PRESTIGE_MAX)
			snprintf(szNameTextTail, sizeof(szNameTextTail), pCharacterInstance->GetNameString(), "%s" "[Prestige %d]", pCharacterInstance->GetPrestigeLevel());
		else
			snprintf(szNameTextTail, sizeof(szNameTextTail), pCharacterInstance->GetNameString(), "%s" "[Prestige Master]");

but it doesn't work ;/ 

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

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Bronze

from reading this http://en.cppreference.com/w/cpp/io/c/fprintf i think this is the solution.

%s is a character string (name) and %d a signed integer (level) so i changed the position in the first snprintf function. Hope this works, never coded in C++. i can only write php but from a logical point of view it should work:


		if (pCharacterInstance->GetPrestigeLevel() < PRESTIGE_MAX)
			snprintf(szNameTextTail, sizeof(szNameTextTail), "%s[Prestige %d]", pCharacterInstance->GetNameString(), pCharacterInstance->GetPrestigeLevel());
		else
			snprintf(szNameTextTail, sizeof(szNameTextTail), "%s[Prestige Master]", pCharacterInstance->GetNameString());

 

Link to comment
Share on other sites

1 godzinę temu, Ayaka napisał:

from reading this http://en.cppreference.com/w/cpp/io/c/fprintf i think this is the solution.

%s is a character string (name) and %d a signed integer (level) so i changed the position in the first snprintf function. Hope this works, never coded in C++. i can only write php but from a logical point of view it should work:



		if (pCharacterInstance->GetPrestigeLevel() < PRESTIGE_MAX)
			snprintf(szNameTextTail, sizeof(szNameTextTail), "%s[Prestige %d]", pCharacterInstance->GetNameString(), pCharacterInstance->GetPrestigeLevel());
		else
			snprintf(szNameTextTail, sizeof(szNameTextTail), "%s[Prestige Master]", pCharacterInstance->GetNameString());

 

Still the same c753ae778b257585c194d2e0112959de.png

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

  • Bronze
vor 10 Minuten schrieb avertuss:

Still the same c753ae778b257585c194d2e0112959de.png

ok thats strange, i was so sure that this is working xD

I would check if this is really the right place to change code. Whats happen if you change the "[" and "]" like:

"%s<Prestige %d>"

if the output isn't <Prestige 1>EbeEbe then this function isn't rendering for your output. 

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

2 godziny temu, Ayaka napisał:

ok thats strange, i was so sure that this is working xD

I would check if this is really the right place to change code. Whats happen if you change the "[" and "]" like:


"%s<Prestige %d>"

if the output isn't <Prestige 1>EbeEbe then this function isn't rendering for your output. 

Okey, so i have this

	std::string stPrestige = "[";
	if (GetPrestigeLevel() == 5)
	{
		stPrestige += "King";
	}
	else
		stPrestige += "Dick";
	stPrestige += "] ";
	//GetNameString() += stPrestige;
	stPrestige += GetNameString();
	CPythonTextTail::Instance().UpdateName(GetVirtualID(), stPrestige.c_str());

This version doesn't work

GetNameString() += stPrestige;

5a251d275cc44b4202c9ce6cb8425b28.png

but this version works

stPrestige += GetNameString();

 

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.