mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-06 18:08:26 +00:00
shavit-chat.sp - add style rank chatranks support
This commit is contained in:
parent
832528bc01
commit
bd740d8504
@ -108,12 +108,16 @@ char gS_CustomName[MAXPLAYERS+1][128];
|
||||
char gS_CustomMessage[MAXPLAYERS+1][16];
|
||||
|
||||
chatstrings_t gS_ChatStrings;
|
||||
stylestrings_t gS_StyleStrings[STYLE_LIMIT];
|
||||
|
||||
// chat procesor
|
||||
bool gB_Protobuf = false;
|
||||
bool gB_NewMessage[MAXPLAYERS+1];
|
||||
StringMap gSM_Messages = null;
|
||||
|
||||
//style ranks
|
||||
int gI_Styles = 0;
|
||||
|
||||
char gS_ControlCharacters[][] = {"\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x09",
|
||||
"\x0A", "\x0B", "\x0C", "\x0D", "\x0E", "\x0F", "\x10" };
|
||||
|
||||
@ -215,6 +219,19 @@ public void Shavit_OnChatConfigLoaded()
|
||||
Shavit_GetChatStringsStruct(gS_ChatStrings);
|
||||
}
|
||||
|
||||
public void Shavit_OnStyleConfigLoaded(int styles)
|
||||
{
|
||||
gI_Styles = styles;
|
||||
|
||||
for (int i = 0; i < STYLE_LIMIT; i++)
|
||||
{
|
||||
if (i < styles)
|
||||
{
|
||||
Shavit_GetStyleStringsStruct(i, gS_StyleStrings[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnMapStart()
|
||||
{
|
||||
if(!LoadChatConfig())
|
||||
@ -1319,6 +1336,24 @@ void FormatChat(int client, char[] buffer, int size)
|
||||
IntToString(iRank, temp, 32);
|
||||
ReplaceString(buffer, size, "{rank}", temp);
|
||||
|
||||
int iStyleRank;
|
||||
char sStyleRank[16];
|
||||
char sStyleBuf[32];
|
||||
for (int i = 0; i < gI_Styles; i++)
|
||||
{
|
||||
iStyleRank = Shavit_GetStyleRank(client, i);
|
||||
if(iStyleRank == 0)
|
||||
{
|
||||
strcopy(sStyleRank, 16, "Unranked");
|
||||
}
|
||||
else
|
||||
{
|
||||
IntToString(iStyleRank, sStyleRank, 16);
|
||||
}
|
||||
FormatEx(sStyleBuf, 32, "{style%drank}", i);
|
||||
ReplaceString(buffer, size, sStyleBuf, sStyleRank);
|
||||
}
|
||||
|
||||
int iRanked = Shavit_GetRankedPlayers();
|
||||
|
||||
if(iRanked == 0)
|
||||
@ -1558,6 +1593,24 @@ public int Native_GetPlainChatrank(Handle handler, int numParams)
|
||||
IntToString(iRank, sRank, 16);
|
||||
ReplaceString(buf, sizeof(buf), "{rank}", sRank);
|
||||
|
||||
int iStyleRank;
|
||||
char sStyleRank[16];
|
||||
char sStyleBuf[32];
|
||||
for (int i = 0; i < gI_Styles; i++)
|
||||
{
|
||||
iStyleRank = Shavit_GetStyleRank(client, i);
|
||||
if(iStyleRank == 0)
|
||||
{
|
||||
strcopy(sStyleRank, 16, "Unranked");
|
||||
}
|
||||
else
|
||||
{
|
||||
IntToString(iStyleRank, sStyleRank, 16);
|
||||
}
|
||||
FormatEx(sStyleBuf, 32, "{style%drank}", i);
|
||||
ReplaceString(buf, sizeof(buf), sStyleBuf, sStyleRank);
|
||||
}
|
||||
|
||||
int iRanked = Shavit_GetRankedPlayers();
|
||||
|
||||
if (iRanked == 0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user