mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 02:18:26 +00:00
fix some advertisements colors not working
This commit is contained in:
parent
2bbb3865f8
commit
ad48aa3345
@ -6,12 +6,14 @@
|
|||||||
char gS_GlobalColorNames[][] =
|
char gS_GlobalColorNames[][] =
|
||||||
{
|
{
|
||||||
"{default}",
|
"{default}",
|
||||||
|
"{def}",
|
||||||
"{team}",
|
"{team}",
|
||||||
"{green}"
|
"{green}"
|
||||||
};
|
};
|
||||||
|
|
||||||
char gS_GlobalColors[][] =
|
char gS_GlobalColors[][] =
|
||||||
{
|
{
|
||||||
|
"\x01",
|
||||||
"\x01",
|
"\x01",
|
||||||
"\x03",
|
"\x03",
|
||||||
"\x04"
|
"\x04"
|
||||||
@ -50,3 +52,33 @@ char gS_CSGOColors[][] =
|
|||||||
"\x09",
|
"\x09",
|
||||||
"\x07"
|
"\x07"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
stock void FormatColors(char[] buffer, int size, bool colors, bool escape, bool csgo, bool funky_chars=true)
|
||||||
|
{
|
||||||
|
if(colors)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < sizeof(gS_GlobalColorNames); i++)
|
||||||
|
{
|
||||||
|
ReplaceString(buffer, size, gS_GlobalColorNames[i], gS_GlobalColors[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(csgo)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < sizeof(gS_CSGOColorNames); i++)
|
||||||
|
{
|
||||||
|
ReplaceString(buffer, size, gS_CSGOColorNames[i], gS_CSGOColors[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (funky_chars) ReplaceString(buffer, size, "^", "\x07");
|
||||||
|
ReplaceString(buffer, size, "{RGB}", "\x07");
|
||||||
|
if (funky_chars) ReplaceString(buffer, size, "&", "\x08");
|
||||||
|
ReplaceString(buffer, size, "{RGBA}", "\x08");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(escape)
|
||||||
|
{
|
||||||
|
ReplaceString(buffer, size, "%%", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -398,7 +398,7 @@ public Action OnClientSayCommand(int client, const char[] command, const char[]
|
|||||||
|
|
||||||
void ReplaceFormats(char[] formatting, int maxlen, char[] name, char[] colon, char[] text)
|
void ReplaceFormats(char[] formatting, int maxlen, char[] name, char[] colon, char[] text)
|
||||||
{
|
{
|
||||||
FormatColors(formatting, maxlen, true, false);
|
FormatColors(formatting, maxlen, true, false, gEV_Type == Engine_CSGO);
|
||||||
FormatRandom(formatting, maxlen);
|
FormatRandom(formatting, maxlen);
|
||||||
ReplaceString(formatting, maxlen, "{name}", name);
|
ReplaceString(formatting, maxlen, "{name}", name);
|
||||||
ReplaceString(formatting, maxlen, "{def}", "\x01");
|
ReplaceString(formatting, maxlen, "{def}", "\x01");
|
||||||
@ -1281,35 +1281,6 @@ public Action Command_CCDelete(int client, int args)
|
|||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormatColors(char[] buffer, int size, bool colors, bool escape)
|
|
||||||
{
|
|
||||||
if(colors)
|
|
||||||
{
|
|
||||||
for(int i = 0; i < sizeof(gS_GlobalColorNames); i++)
|
|
||||||
{
|
|
||||||
ReplaceString(buffer, size, gS_GlobalColorNames[i], gS_GlobalColors[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(gEV_Type == Engine_CSGO)
|
|
||||||
{
|
|
||||||
for(int i = 0; i < sizeof(gS_CSGOColorNames); i++)
|
|
||||||
{
|
|
||||||
ReplaceString(buffer, size, gS_CSGOColorNames[i], gS_CSGOColors[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ReplaceString(buffer, size, "^", "\x07");
|
|
||||||
ReplaceString(buffer, size, "{RGB}", "\x07");
|
|
||||||
ReplaceString(buffer, size, "&", "\x08");
|
|
||||||
ReplaceString(buffer, size, "{RGBA}", "\x08");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(escape)
|
|
||||||
{
|
|
||||||
ReplaceString(buffer, size, "%%", "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void FormatRandom(char[] buffer, int size)
|
void FormatRandom(char[] buffer, int size)
|
||||||
{
|
{
|
||||||
char temp[8];
|
char temp[8];
|
||||||
@ -1331,7 +1302,7 @@ void FormatRandom(char[] buffer, int size)
|
|||||||
|
|
||||||
void FormatChat(int client, char[] buffer, int size)
|
void FormatChat(int client, char[] buffer, int size)
|
||||||
{
|
{
|
||||||
FormatColors(buffer, size, true, true);
|
FormatColors(buffer, size, true, true, gEV_Type == Engine_CSGO);
|
||||||
FormatRandom(buffer, size);
|
FormatRandom(buffer, size);
|
||||||
|
|
||||||
char temp[33];
|
char temp[33];
|
||||||
|
|||||||
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include <shavit/core>
|
#include <shavit/core>
|
||||||
#include <shavit/misc>
|
#include <shavit/misc>
|
||||||
|
#include <shavit/chat-colors>
|
||||||
|
|
||||||
#undef REQUIRE_PLUGIN
|
#undef REQUIRE_PLUGIN
|
||||||
#include <shavit/chat>
|
#include <shavit/chat>
|
||||||
@ -663,9 +664,10 @@ bool LoadAdvertisementsConfig()
|
|||||||
ReplaceString(sTempMessage, 300, "{variable2}", gS_ChatStrings.sVariable2);
|
ReplaceString(sTempMessage, 300, "{variable2}", gS_ChatStrings.sVariable2);
|
||||||
ReplaceString(sTempMessage, 300, "{style}", gS_ChatStrings.sStyle);
|
ReplaceString(sTempMessage, 300, "{style}", gS_ChatStrings.sStyle);
|
||||||
|
|
||||||
|
FormatColors(sTempMessage, 300, true, false, gEV_Type == Engine_CSGO, false);
|
||||||
|
|
||||||
gA_Advertisements.PushString(sTempMessage);
|
gA_Advertisements.PushString(sTempMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
while(kv.GotoNextKey(false));
|
while(kv.GotoNextKey(false));
|
||||||
|
|
||||||
delete kv;
|
delete kv;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user