Fixed CS:S HUD breaking apart after adding new styles without restart.

This commit is contained in:
shavit 2018-03-20 04:32:47 +02:00
parent cc8dd17c07
commit fdeceabcf0
2 changed files with 14 additions and 23 deletions

View File

@ -400,24 +400,11 @@ public void OnMapStart()
SetFailState("Could not load the styles configuration file. Make sure it exists (addons/sourcemod/configs/shavit-styles.cfg) and follows the proper syntax!");
}
else
{
Call_StartForward(gH_Forwards_OnStyleConfigLoaded);
Call_PushCell(gI_Styles);
Call_Finish();
}
// messages
if(!LoadMessages())
{
SetFailState("Could not load the chat messages configuration file. Make sure it exists (addons/sourcemod/configs/shavit-messages.cfg) and follows the proper syntax!");
}
else
{
Call_StartForward(gH_Forwards_OnChatConfigLoaded);
Call_Finish();
}
}
public void OnMapEnd()
@ -1511,6 +1498,10 @@ bool LoadStyles()
gI_Styles = i;
gB_Registered = true;
Call_StartForward(gH_Forwards_OnStyleConfigLoaded);
Call_PushCell(gI_Styles);
Call_Finish();
return true;
}
@ -1572,6 +1563,9 @@ bool LoadMessages()
ReplaceString(gS_ChatStrings[i], 128, "{RGBA}", "\x08");
}
Call_StartForward(gH_Forwards_OnChatConfigLoaded);
Call_Finish();
return true;
}

View File

@ -173,15 +173,6 @@ public void OnPluginStart()
// cache
gA_ValidMaps = new ArrayList(192);
for(int i = 0; i < STYLE_LIMIT; i++)
{
for(int j = 0; j < TRACKS_SIZE; j++)
{
gA_Leaderboard[i][j] = new ArrayList();
gI_RecordAmount[i][j] = 0;
}
}
SQL_SetPrefix();
}
@ -370,7 +361,13 @@ public void Shavit_OnStyleConfigLoaded(int styles)
{
if(i < styles)
{
if(gA_Leaderboard[i][j] == null)
{
gA_Leaderboard[i][j] = new ArrayList();
}
gA_Leaderboard[i][j].Clear();
gI_RecordAmount[i][j] = 0;
}
else
@ -544,7 +541,7 @@ public int Native_GetRankForTime(Handle handler, int numParams)
int style = GetNativeCell(1);
int track = GetNativeCell(3);
if(gA_Leaderboard[style][track].Length == 0)
if(gA_Leaderboard[style][track] == null || gA_Leaderboard[style][track].Length == 0)
{
return 1;
}