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

How to modify this function to send a private message instead of a chat_whisper.



Hi could anyone tell me how to modify this function so that it will send a PM (private message) to the name after @ instead of a chat_type_whisper?

	std::string findstr(buf);
	if (findstr.at(0) == '@') 
		findstr = findstr.substr(1);
		int pos = findstr.find(" ");
		std::string message = findstr.substr(pos + 1), chname = findstr.substr(0, pos);

		LPCHARACTER stch = CHARACTER_MANAGER::instance().FindPC(chname.c_str());
		if (stch)
			if (message.size() - chname.size() <= 1 )
				ch->ChatPacket(CHAT_TYPE_INFO, "You haven't written a message or it is too short.");
				return (iExtraLen);
			if (ch->GetLastPMPulse() < thecore_pulse())
			if (ch->GetPMCounter() > 3 && ch->GetLastPMPulse() > thecore_pulse())
					return -1;
			if (stch == ch)
				ch->ChatPacket(CHAT_TYPE_INFO, "You can't send message to yourself.");
				return (iExtraLen);
			stch->ChatPacket(CHAT_TYPE_WHISPER, "%s: %s", ch->GetName(), message.c_str());
			ch->ChatPacket(CHAT_TYPE_WHISPER, "To %s: %s", stch->GetName(), message.c_str());
			ch->ChatPacket(CHAT_TYPE_INFO, "The player doesn't exist or is not online.");
		return (iExtraLen);


Link to comment
Share on other sites

  • Answers 0
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

Popular Days

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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.