Commit b2871e03 authored by Mario's avatar Mario

Process the message so /me can be handled properly

parent d9ddf453
Pipeline #33898178 passed with stage
in 13 minutes and 41 seconds
......@@ -2741,6 +2741,22 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
int privatemsgprefixlen = 0;
if (msgin != "")
{
bool found_me = false;
if(strstrofs(msgin, "/me", 0) >= 0)
{
string newmsgin = "";
string newnamestr = ((teamsay) ? strcat(colorstr, "(", colorprefix, namestr, colorstr, ")^7") : strcat(colorprefix, namestr));
found_me = true;
FOREACH_WORD(msgin, true,
{
if(strdecolorize(it) == "/me")
newmsgin = cons(newmsgin, newnamestr);
else
newmsgin = cons(newmsgin, it);
});
msgin = newmsgin;
}
if(privatesay)
{
msgstr = strcat("\{1}\{13}* ", colorprefix, namestr, "^3 tells you: ^7");
......@@ -2751,11 +2767,11 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
}
else if(teamsay)
{
if(strstrofs(msgin, "/me", 0) >= 0)
if(found_me)
{
//msgin = strreplace("/me", "", msgin);
//msgin = substring(msgin, 3, strlen(msgin));
msgin = strreplace("/me", strcat(colorstr, "(", colorprefix, namestr, colorstr, ")^7"), msgin);
//msgin = strreplace("/me", strcat(colorstr, "(", colorprefix, namestr, colorstr, ")^7"), msgin);
msgstr = strcat("\{1}\{13}^4* ", "^7", msgin);
}
else
......@@ -2764,11 +2780,11 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
}
else
{
if(strstrofs(msgin, "/me", 0) >= 0)
if(found_me)
{
//msgin = strreplace("/me", "", msgin);
//msgin = substring(msgin, 3, strlen(msgin));
msgin = strreplace("/me", strcat(colorprefix, namestr), msgin);
//msgin = strreplace("/me", strcat(colorprefix, namestr), msgin);
msgstr = strcat("\{1}^4* ", "^7", msgin);
}
else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment