Jump to content
×
×
  • Create New...
  • 0

Changing position c++


avertuss

Question

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 ;/ 

Link to comment
Share on other sites

  • Answers 4
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

4 answers to this question

Recommended Posts

  • 0

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

  • 0
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

Link to comment
Share on other sites

  • 0
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. 

Link to comment
Share on other sites

  • 0
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();

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.


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.