Jump to content
  • Join-Us

    https://metin2.dev is the 1st international community on Metin2 development. Join us to develop your skills and share your knowledge with the community, respectful and ethical forum.

  • 0

Filtering the chat




Im trying with a function to filter some string from the chat, but it gives a strange error.


const char* FilterChat(const char* c_pszBuffer)
    std::string strChatBuf = c_pszBuffer;

    // Other stuff with the string, but its commented out rn.
    char szTmpBuf[1024 + 1] = {};
    const char* c_szpFilterBuf = strChatBuf.c_str();
    _snprintf(szTmpBuf, sizeof(szTmpBuf), "%s", c_szpFilterBuf);

    return szTmpBuf;


In bool CPythonNetworkStream::RecvChatPacket():

	CPythonTextTail::Instance().RegisterChatTail(kChat.dwVID, FilterChat(line));
	CPythonTextTail::Instance().RegisterChatTail(kChat.dwVID, line);


And in-game its junk:



What's the problem? With debugging it seems the array gets created with full of junk already, but i've initialized it with full of zeroes if im not wrong.

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

4 answers to this question

Recommended Posts

  • 0
  • Moderator

1>PythonNetworkStreamPhaseGame.cpp(xxxx): warning C4172: returning address of local variable or temporary




That's a small tip for the next time when you're coding, so you'll know if it's a critical warning and it needs real attention or not, based on the level.


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

This topic is now closed to further replies.

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