mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-09 11:28:26 +00:00
try to recreate wrhrankmain & friends if there's an error about them not existing
This commit is contained in:
parent
5a813a01b1
commit
ab0de50a9f
@ -94,6 +94,7 @@ Handle gH_Forwards_OnRankAssigned = null;
|
|||||||
chatstrings_t gS_ChatStrings;
|
chatstrings_t gS_ChatStrings;
|
||||||
int gI_Styles = 0;
|
int gI_Styles = 0;
|
||||||
|
|
||||||
|
bool gB_WRsRefreshed = false;
|
||||||
int gI_WRAmount[MAXPLAYERS+1][2][STYLE_LIMIT];
|
int gI_WRAmount[MAXPLAYERS+1][2][STYLE_LIMIT];
|
||||||
int gI_WRAmountAll[MAXPLAYERS+1];
|
int gI_WRAmountAll[MAXPLAYERS+1];
|
||||||
int gI_WRAmountCvar[MAXPLAYERS+1];
|
int gI_WRAmountCvar[MAXPLAYERS+1];
|
||||||
@ -357,9 +358,12 @@ public void OnClientConnected(int client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void OnClientPutInServer(int client)
|
public void OnClientPutInServer(int client)
|
||||||
|
{
|
||||||
|
if (gB_WRsRefreshed)
|
||||||
{
|
{
|
||||||
UpdateWRs(client);
|
UpdateWRs(client);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void OnClientPostAdminCheck(int client)
|
public void OnClientPostAdminCheck(int client)
|
||||||
{
|
{
|
||||||
@ -473,6 +477,7 @@ public void OnMapEnd()
|
|||||||
{
|
{
|
||||||
RecalculateAll(gS_Map);
|
RecalculateAll(gS_Map);
|
||||||
gB_TierQueried = false;
|
gB_TierQueried = false;
|
||||||
|
gB_WRsRefreshed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Player_Event(Event event, const char[] name, bool dontBroadcast)
|
public void Player_Event(Event event, const char[] name, bool dontBroadcast)
|
||||||
@ -513,8 +518,23 @@ void UpdateWRs(int client)
|
|||||||
public void SQL_GetWRs_Callback(Database db, DBResultSet results, const char[] error, any data)
|
public void SQL_GetWRs_Callback(Database db, DBResultSet results, const char[] error, any data)
|
||||||
{
|
{
|
||||||
if(results == null)
|
if(results == null)
|
||||||
|
{
|
||||||
|
// Try to recreate temporary tables.
|
||||||
|
// If the db connection drops and disconnects it might be destroying them... but idk.
|
||||||
|
if (StrContains(error, "Table ") != -1 && StrContains(error, " doesn't exist") != -1)
|
||||||
|
{
|
||||||
|
if (gB_WRsRefreshed)
|
||||||
|
{
|
||||||
|
LogError("SQL_GetWRs_Callback failed. Attempting to recreate tables. Error: %s", error);
|
||||||
|
gB_WRsRefreshed = false;
|
||||||
|
RequestFrame(UpdateWRHolders);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
LogError("SQL_GetWRs_Callback failed. Reason: %s", error);
|
LogError("SQL_GetWRs_Callback failed. Reason: %s", error);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1155,6 +1175,16 @@ public void SQL_GetWRHolders_Callback(Database db, DBResultSet results, const ch
|
|||||||
gI_WRHoldersCvar = total;
|
gI_WRHoldersCvar = total;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gB_WRsRefreshed = true;
|
||||||
|
|
||||||
|
for (int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if (IsValidClient(i))
|
||||||
|
{
|
||||||
|
UpdateWRs(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Native_GetWRCount(Handle handler, int numParams)
|
public int Native_GetWRCount(Handle handler, int numParams)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user