Jump to content

Chat Prefix


Guest Kroket

Recommended Posts

I tried:


void Player::Say(const std::string& text, const uint32 language)
{
   WorldPacket data(SMSG_MESSAGECHAT, 100);
   if(isDonator()) {
       std::string prefix = "[Donator] ";
       data << prefix.length()+1;
       data << prefix;
   }
   BuildPlayerChat(&data, CHAT_MSG_SAY, text, language);
   SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_SAY),true);
}

But that wont work.

Link to comment
Share on other sites

void Player::Say(const std::string& text, const uint32 language)
{
   WorldPacket data(SMSG_MESSAGECHAT, 100);
   if(isDonator()) text.insert(0, "[Donator] ");
   BuildPlayerChat(&data, CHAT_MSG_SAY, text, language);
   SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_SAY),true);
}

Link to comment
Share on other sites

void Player::Say(const std::string& text, const uint32 language)
{
   WorldPacket data(SMSG_MESSAGECHAT, 100);
   std::string str;
   if(isDonator()) str += "[Donator] ";
   str += text;
   BuildPlayerChat(&data, CHAT_MSG_SAY, str, language);
   SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_FLOAT_LISTEN_RANGE_SAY),true);
}

offtopic: personally i would find annoying if all my chat messages contained "Donator" or stuff like that

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

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. Privacy Policy Terms of Use