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