Lightning Blade
BETA Tester
Hey everyone, I though I would put this out there since I felt like contributing.
This tutorial will probably help you if you want to change the MSG_SAY. This tutorial specificly changes the color of specific player rank's messages.
My tutorial is also targeted at beginners.
-- Start of Tutorial --
Open your ChatHandler.cpp and find your way to
We want to add another string variable at the end.
Now find your way to the type switch ( There are more than 1, so use the info below to find the right one ). -- For people who search - switch (type)
Inside the switch you should see this IF STATEMENT.
As a note, you can use the changes we're about to make, on these two ELSE IF STATEMENTS to accomplish the same result with those CHAT_MSG_TYPES.
Back to the actual modification. Replace
With
Just change color = "";(Marked as brown) to have a value inside ""(Could be a color or a message like [VIP]), you can create any case you'd like as long as the SEC is valid .
Case Template
Now in this example I use the variable color that we made earlier to define what kind of text we want before the message, since this is a string, the name does not limit it and thereby we can conclude that you can write any message for it to output , for example [VIP].
All you have to do now is compile and it works .
-- Tutorial End --.
I hope you found this tutorial helpful. Regardless if you did or did not have a great day!.
This tutorial will probably help you if you want to change the MSG_SAY. This tutorial specificly changes the color of specific player rank's messages.
My tutorial is also targeted at beginners.
-- Start of Tutorial --
Open your ChatHandler.cpp and find your way to
Code:
std::string to, channel, msg;
Code:
std::string to, channel, msg[COLOR="#008000"], color[/COLOR];
Now find your way to the type switch ( There are more than 1, so use the info below to find the right one ). -- For people who search - switch (type)
Inside the switch you should see this IF STATEMENT.
Code:
if (type == CHAT_MSG_SAY)
sender->Say(color + msg, Language(lang));
Code:
else if (type == CHAT_MSG_EMOTE)
sender->TextEmote(msg);
else if (type == CHAT_MSG_YELL)
sender->Yell(msg, Language(lang));
Back to the actual modification. Replace
Code:
if (type == CHAT_MSG_SAY)
sender->Say(color + msg, Language(lang));
With
Code:
if (type == CHAT_MSG_SAY)
[COLOR="#008000"]{
switch (sender->GetSession()->GetSecurity())
{
case SEC_PLAYER:
[COLOR="#A52A2A"]color = "";[/COLOR]
break;
case SEC_MODERATOR:
[COLOR="#A52A2A"]color = "";[/COLOR]
break;
case SEC_GAMEMASTER:
[COLOR="#A52A2A"]color = "";[/COLOR]
break;
case SEC_ADMINISTRATOR:
[COLOR="#A52A2A"]color = "";[/COLOR]
break;
}[/COLOR]
sender->Say([COLOR="#008000"]color + [/COLOR]msg, Language(lang));
[COLOR="#008000"]}[/COLOR]
Just change color = "";(Marked as brown) to have a value inside ""(Could be a color or a message like [VIP]), you can create any case you'd like as long as the SEC is valid .
Case Template
Code:
Case SEC_PLAYER:
break;
Now in this example I use the variable color that we made earlier to define what kind of text we want before the message, since this is a string, the name does not limit it and thereby we can conclude that you can write any message for it to output , for example [VIP].
All you have to do now is compile and it works .
-- Tutorial End --.
I hope you found this tutorial helpful. Regardless if you did or did not have a great day!.
Last edited: