Jump to content

Recommended Posts

Posted

How would i add an prefix to players that meet certain requirements such as being a donator.

Example: [Donator] pName Says: Hi!

I can just add the prefix to the world packet?

Posted

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.

Posted

..\\..\\src\\game\\Player.cpp(15796) : error C2663: 'std::basic_string<_Elem,_Traits,_Ax>::insert' : 10 overloads have no legal conversion for 'this' pointer

2> with

2> [

2> _Elem=char,

2> _Traits=std::char_traits<char>,

2> _Ax=std::allocator<char>

2> ]

Posted
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);
}

Posted

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

Posted

   if(type == CHAT_MSG_SAY) {
               if(GetPlayer()->isDonator()) msg.insert(0, "[Donator] ");
               GetPlayer()->Say(msg, lang);
           }

But now it appears INFRONT of the message and not infront of the player name.

Posted
   if(type == CHAT_MSG_SAY) {
               if(GetPlayer()->isDonator()) msg.insert(0, "[Donator] ");
               GetPlayer()->Say(msg, lang);
           }

But now it appears INFRONT of the message and not infront of the player name.

I think that's client-side, not server-side.

Posted

Are you sure? few years ago when i had an arcemu server i managed to add it infront of the player name.

There also was this server that added people's country code infront of their name (if im not mistaken).

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