cleaning datapacks and database connections and adding check for fakeclients

This commit is contained in:
Christian 2021-03-08 21:47:50 +01:00
parent b3ffd0200a
commit d2ef826790

View File

@ -146,6 +146,7 @@ public void SQL_FinishedQuery(Database db, DBResultSet results, const char[] err
LogError("Query error 3: %s", error); LogError("Query error 3: %s", error);
LogError("actual query: %s", sQuery); LogError("actual query: %s", sQuery);
} }
delete data;
} }
public void OnMapStart() public void OnMapStart()
@ -153,6 +154,12 @@ public void OnMapStart()
Database.Connect(SQL_OnDatabaseConnect, "racetimercss"); Database.Connect(SQL_OnDatabaseConnect, "racetimercss");
} }
public void OnMapEnd()
{
if (g_dDatabase != null)
delete g_dDatabase;
}
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -191,7 +198,7 @@ public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast
if (!l_iZoneCount) if (!l_iZoneCount)
return; return;
for (int i = 1; i <= MaxClients; i++) for (int i = 1; i <= MaxClients; i++)
if (IsValidClient(i)) if (IsValidClient(i) && !IsFakeClient(i))
{ {
resetClientVectors(i); resetClientVectors(i);
if (l_iZoneCount != 1) if (l_iZoneCount != 1)
@ -556,8 +563,10 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[]
data.ReadString(sQuery, sizeof(sQuery)); data.ReadString(sQuery, sizeof(sQuery));
LogError("Query error 1: %s", error); LogError("Query error 1: %s", error);
LogError("actual query: %s", sQuery); LogError("actual query: %s", sQuery);
delete data;
return; return;
} }
delete data;
int client; int client;
if ((client = GetClientFromSerial(client_serial)) == 0) if ((client = GetClientFromSerial(client_serial)) == 0)
return; return;
@ -654,9 +663,10 @@ public void SQL_Select_Top_Callback(Database db, DBResultSet results, const char
data.ReadString(sQuery, sizeof(sQuery)); data.ReadString(sQuery, sizeof(sQuery));
LogError("Query error 2: %s", error); LogError("Query error 2: %s", error);
LogError("actual query: %s", sQuery); LogError("actual query: %s", sQuery);
delete data;
return; return;
} }
delete data;
int iclient; int iclient;
if ((iclient = GetClientFromSerial(client_serial)) == 0) if ((iclient = GetClientFromSerial(client_serial)) == 0)
return; return;
@ -884,8 +894,10 @@ public void SQL_CheckSelf(Database db, DBResultSet results, const char[] error,
data.ReadString(sQuery, sizeof(sQuery)); data.ReadString(sQuery, sizeof(sQuery));
LogError("Query error 4: %s", error); LogError("Query error 4: %s", error);
LogError("actual query: %s", sQuery); LogError("actual query: %s", sQuery);
delete data;
return; return;
} }
delete data;
char sTime[g_dLength]; char sTime[g_dLength];
char l_cMessageContent[g_dLength]; char l_cMessageContent[g_dLength];
char[] l_cPlayerName = new char[MAX_NAME_LENGTH]; char[] l_cPlayerName = new char[MAX_NAME_LENGTH];