avertuss 48 Posted May 2, 2017 Share Posted May 2, 2017 (edited) 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 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 August 20, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Ayaka 300 Posted May 2, 2017 Share Posted May 2, 2017 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()); F E E L - T H E - A W E S O M E N E S S Link to comment Share on other sites More sharing options...
avertuss 48 Posted May 2, 2017 Author Share Posted May 2, 2017 (edited) 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 Edited August 20, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Ayaka 300 Posted May 2, 2017 Share Posted May 2, 2017 (edited) vor 10 Minuten schrieb avertuss: Still the same 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 August 20, 2022 by Metin2 Dev Core X - External 2 Internal F E E L - T H E - A W E S O M E N E S S Link to comment Share on other sites More sharing options...
avertuss 48 Posted May 2, 2017 Author Share Posted May 2, 2017 (edited) 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; but this version works stPrestige += GetNameString(); Edited August 20, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now