delete dbresults in more cases, some printing, using getclientserial
This commit is contained in:
parent
48d793437a
commit
334b5bbde4
@ -184,12 +184,16 @@ public void SQL_OnConnectFinished(Database db, DBResultSet results, const char[]
|
|||||||
{
|
{
|
||||||
if(!db || strlen(error))
|
if(!db || strlen(error))
|
||||||
{
|
{
|
||||||
|
delete results;
|
||||||
LogError("Database error: %s", error);
|
LogError("Database error: %s", error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
static Handle hHostName;
|
static Handle hHostName;
|
||||||
if((hHostName = FindConVar("hostname")) == INVALID_HANDLE)
|
if((hHostName = FindConVar("hostname")) == INVALID_HANDLE)
|
||||||
|
{
|
||||||
|
delete results;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
char line[g_dLength];
|
char line[g_dLength];
|
||||||
GetConVarString(hHostName, line, sizeof(line));
|
GetConVarString(hHostName, line, sizeof(line));
|
||||||
if (StrContains(line, "EVENT", false) > -1)
|
if (StrContains(line, "EVENT", false) > -1)
|
||||||
@ -204,6 +208,7 @@ public void SQL_OnConnectFinished(Database db, DBResultSet results, const char[]
|
|||||||
if (IsValidClient(i))
|
if (IsValidClient(i))
|
||||||
OnClientPostAdminCheck(i);
|
OnClientPostAdminCheck(i);
|
||||||
AddBinarySearchIndex();
|
AddBinarySearchIndex();
|
||||||
|
delete results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MYSQLCheckMapEntry()
|
public void MYSQLCheckMapEntry()
|
||||||
@ -238,15 +243,16 @@ public void MYSQLCheckMapEntry()
|
|||||||
|
|
||||||
public void SQL_FinishedQuery(Database db, DBResultSet results, const char[] error, DataPack data)
|
public void SQL_FinishedQuery(Database db, DBResultSet results, const char[] error, DataPack data)
|
||||||
{
|
{
|
||||||
if (!db || strlen(error))
|
delete results;
|
||||||
{
|
if (!db || strlen(error))
|
||||||
char sQuery[g_dLength];
|
{
|
||||||
ResetPack(data);
|
char sQuery[g_dLength];
|
||||||
data.ReadString(sQuery, sizeof(sQuery));
|
ResetPack(data);
|
||||||
LogError("Query error 3: %s", error);
|
data.ReadString(sQuery, sizeof(sQuery));
|
||||||
LogError("actual query: %s", sQuery);
|
LogError("Query error 3: %s", error);
|
||||||
}
|
LogError("actual query: %s", sQuery);
|
||||||
delete data;
|
}
|
||||||
|
delete data;
|
||||||
}
|
}
|
||||||
|
|
||||||
//a mysql table can max have 64 keys attached to it without recompiling. Therefore dropping and attaching binary tree index on the given map start, map end,
|
//a mysql table can max have 64 keys attached to it without recompiling. Therefore dropping and attaching binary tree index on the given map start, map end,
|
||||||
@ -416,17 +422,28 @@ public void client_ignoring_racetimer(int client)
|
|||||||
char steam_auth[g_dIndex];
|
char steam_auth[g_dIndex];
|
||||||
GetClientAuthId(client, AuthId_Steam2, steam_auth, sizeof(steam_auth));
|
GetClientAuthId(client, AuthId_Steam2, steam_auth, sizeof(steam_auth));
|
||||||
Format(query, sizeof(query), "SELECT is_ignoring FROM `zetimer_table_new_ignoring` where steam_auth = '%s'", steam_auth);
|
Format(query, sizeof(query), "SELECT is_ignoring FROM `zetimer_table_new_ignoring` where steam_auth = '%s'", steam_auth);
|
||||||
g_dDatabase.Query(SQL_OnQueryCompleted_ignoring, query, client);
|
|
||||||
|
g_dDatabase.Query(SQL_OnQueryCompleted_ignoring, query, GetClientSerial(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SQL_OnQueryCompleted_ignoring(Database db, DBResultSet results, const char[] error, int client)
|
public void SQL_OnQueryCompleted_ignoring(Database db, DBResultSet results, const char[] error, int Serial)
|
||||||
{
|
{
|
||||||
if (!db)
|
if (!db)
|
||||||
{
|
{
|
||||||
|
delete results;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int client;
|
||||||
|
if ((client = GetClientFromSerial(Serial)) == 0)
|
||||||
|
{
|
||||||
|
delete results;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!IsValidClient(client))
|
if (!IsValidClient(client))
|
||||||
|
{
|
||||||
|
delete results;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
int val = 0;
|
int val = 0;
|
||||||
if (results.RowCount && results.FetchRow())
|
if (results.RowCount && results.FetchRow())
|
||||||
val = results.FetchInt(0);
|
val = results.FetchInt(0);
|
||||||
@ -435,6 +452,7 @@ public void SQL_OnQueryCompleted_ignoring(Database db, DBResultSet results, cons
|
|||||||
{
|
{
|
||||||
g_bClientsIgnoring[client] = true;
|
g_bClientsIgnoring[client] = true;
|
||||||
}
|
}
|
||||||
|
delete results;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
@ -689,6 +707,7 @@ public void unloze_zoneLeave(int client, char[] zone)
|
|||||||
}
|
}
|
||||||
if (!g_bClient_allowed_to_leave_again[client])
|
if (!g_bClient_allowed_to_leave_again[client])
|
||||||
{
|
{
|
||||||
|
PrintToChat(client, "Did not start timer due to teleport cooldown.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -767,16 +786,16 @@ public void FinishedStageRaceZone(int client)
|
|||||||
}
|
}
|
||||||
if (l_iZoneCount > 1)
|
if (l_iZoneCount > 1)
|
||||||
CPrintToChat(client, "{green}[UNLOZE] Stage: %i", player_stage[client]);
|
CPrintToChat(client, "{green}[UNLOZE] Stage: %i", player_stage[client]);
|
||||||
CPrintToChat(client, "{green}[UNLOZE] Client: %N Time: %06.3f", client, client_time);
|
CPrintToChat(client, "{green}[UNLOZE] Time: %06.3f", client_time);
|
||||||
int stage = player_stage[client];
|
int stage = player_stage[client];
|
||||||
char sQuery[g_dLength];
|
char sQuery[g_dLength];
|
||||||
if (StrEqual(g_csTime_record[client], "0.000"))
|
if (StrEqual(g_csTime_record[client], "0.000"))
|
||||||
{
|
{
|
||||||
CPrintToChat(client, "Your record: None yet\nCommand: !toptime !mytime !stages");
|
CPrintToChat(client, "{green}[UNLOZE] Your record: None yet\nCommand: !toptime !mytime !stages");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CPrintToChat(client, "Your record: %s\nCommand: !toptime !mytime !stages", g_csTime_record[client]);
|
CPrintToChat(client, "{green}[UNLOZE] Your record: %s\nCommand: !toptime !mytime !stages", g_csTime_record[client]);
|
||||||
}
|
}
|
||||||
if (l_iZoneCount < 2)
|
if (l_iZoneCount < 2)
|
||||||
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table_new` SET `%s` = '%06.3f', name = '%s' WHERE steam_auth = '%s'", g_cMapname, client_time, sEscapedName, sSID);
|
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table_new` SET `%s` = '%06.3f', name = '%s' WHERE steam_auth = '%s'", g_cMapname, client_time, sEscapedName, sSID);
|
||||||
@ -835,18 +854,24 @@ public void SQL_OnQueryCompleted_retry(Database db, DBResultSet results, const c
|
|||||||
delete data;
|
delete data;
|
||||||
if (!db)
|
if (!db)
|
||||||
{
|
{
|
||||||
|
delete results;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int client;
|
int client;
|
||||||
if ((client = GetClientFromSerial(client_serial)) == 0)
|
if ((client = GetClientFromSerial(client_serial)) == 0)
|
||||||
|
{
|
||||||
|
delete results;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (strlen(error))
|
if (strlen(error))
|
||||||
{
|
{
|
||||||
|
delete results;
|
||||||
mysql_get_player_time(client, 1);
|
mysql_get_player_time(client, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (results.RowCount && results.FetchRow())
|
if (results.RowCount && results.FetchRow())
|
||||||
results.FetchString(0, g_csTime_record[client], sizeof(g_csTime_record[]));
|
results.FetchString(0, g_csTime_record[client], sizeof(g_csTime_record[]));
|
||||||
|
delete results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[] error, DataPack data)
|
public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[] error, DataPack data)
|
||||||
@ -860,14 +885,19 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[]
|
|||||||
LogError("Query error 1: %s", error);
|
LogError("Query error 1: %s", error);
|
||||||
LogError("actual query: %s", sQuery);
|
LogError("actual query: %s", sQuery);
|
||||||
delete data;
|
delete data;
|
||||||
|
delete results;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
delete data;
|
delete data;
|
||||||
int client;
|
int client;
|
||||||
if ((client = GetClientFromSerial(client_serial)) == 0)
|
if ((client = GetClientFromSerial(client_serial)) == 0)
|
||||||
|
{
|
||||||
|
delete results;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (results.RowCount && results.FetchRow())
|
if (results.RowCount && results.FetchRow())
|
||||||
results.FetchString(0, g_csTime_record[client], sizeof(g_csTime_record[]));
|
results.FetchString(0, g_csTime_record[client], sizeof(g_csTime_record[]));
|
||||||
|
delete results;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -1027,7 +1057,10 @@ public void SQL_Select_Top_Callback(Database db, DBResultSet results, const char
|
|||||||
delete data;
|
delete data;
|
||||||
int iclient;
|
int iclient;
|
||||||
if ((iclient = GetClientFromSerial(client_serial)) == 0)
|
if ((iclient = GetClientFromSerial(client_serial)) == 0)
|
||||||
|
{
|
||||||
|
delete results;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
//Player Name
|
//Player Name
|
||||||
char[] g_cPlayerName = new char[MAX_NAME_LENGTH];
|
char[] g_cPlayerName = new char[MAX_NAME_LENGTH];
|
||||||
char g_cContent[g_dLength];
|
char g_cContent[g_dLength];
|
||||||
@ -1060,6 +1093,7 @@ public void SQL_Select_Top_Callback(Database db, DBResultSet results, const char
|
|||||||
menu.ExitButton = true;
|
menu.ExitButton = true;
|
||||||
menu.Display(iclient, 0);
|
menu.Display(iclient, 0);
|
||||||
}
|
}
|
||||||
|
delete results;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
@ -1196,15 +1230,15 @@ public Action cmd_timerCheckSelf(int client, int args)
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public void deleteClientTime(char[] steam2, int stage)
|
public void deleteClientTime(char[] steam2, int stage)
|
||||||
{
|
{
|
||||||
char l_cQuery[g_dLength];
|
char l_cQuery[g_dLength];
|
||||||
int l_iZoneCount = unloze_zoneCount();
|
int l_iZoneCount = unloze_zoneCount();
|
||||||
if (l_iZoneCount > 1)
|
if (l_iZoneCount > 1)
|
||||||
Format(l_cQuery, sizeof(l_cQuery), "UPDATE `zetimer_table_new` SET `%sS%i` = 0.000 WHERE steam_auth = '%s'", g_cMapname, stage, steam2);
|
Format(l_cQuery, sizeof(l_cQuery), "UPDATE `zetimer_table_new` SET `%sS%i` = 0.000 WHERE steam_auth = '%s'", g_cMapname, stage, steam2);
|
||||||
else
|
else
|
||||||
Format(l_cQuery, sizeof(l_cQuery), "UPDATE `zetimer_table_new` SET `%s` = 0.000 WHERE steam_auth = '%s'", g_cMapname, steam2);
|
Format(l_cQuery, sizeof(l_cQuery), "UPDATE `zetimer_table_new` SET `%s` = 0.000 WHERE steam_auth = '%s'", g_cMapname, steam2);
|
||||||
DataPack hDataPack = new DataPack();
|
DataPack hDataPack = new DataPack();
|
||||||
hDataPack.WriteString(l_cQuery);
|
hDataPack.WriteString(l_cQuery);
|
||||||
g_dDatabase.Query(SQL_FinishedQuery, l_cQuery, hDataPack, DBPrio_Normal);
|
g_dDatabase.Query(SQL_FinishedQuery, l_cQuery, hDataPack, DBPrio_Normal);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
@ -1260,6 +1294,7 @@ public void SQL_CheckSelf(Database db, DBResultSet results, const char[] error,
|
|||||||
LogError("Query error 4: %s", error);
|
LogError("Query error 4: %s", error);
|
||||||
LogError("actual query: %s", sQuery);
|
LogError("actual query: %s", sQuery);
|
||||||
delete data;
|
delete data;
|
||||||
|
delete results;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
delete data;
|
delete data;
|
||||||
@ -1267,7 +1302,10 @@ public void SQL_CheckSelf(Database db, DBResultSet results, const char[] error,
|
|||||||
char[] l_cPlayerName = new char[MAX_NAME_LENGTH];
|
char[] l_cPlayerName = new char[MAX_NAME_LENGTH];
|
||||||
int iclient;
|
int iclient;
|
||||||
if ((iclient = GetClientFromSerial(client_serial)) == 0)
|
if ((iclient = GetClientFromSerial(client_serial)) == 0)
|
||||||
|
{
|
||||||
|
delete results;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (results.RowCount && results.FetchRow())
|
if (results.RowCount && results.FetchRow())
|
||||||
{
|
{
|
||||||
results.FetchString(0, l_cPlayerName, MAX_NAME_LENGTH);
|
results.FetchString(0, l_cPlayerName, MAX_NAME_LENGTH);
|
||||||
@ -1275,6 +1313,7 @@ public void SQL_CheckSelf(Database db, DBResultSet results, const char[] error,
|
|||||||
if (fTime == 0.0)
|
if (fTime == 0.0)
|
||||||
{
|
{
|
||||||
CPrintToChat(iclient, "You have no time yet!");
|
CPrintToChat(iclient, "You have no time yet!");
|
||||||
|
delete results;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fTime += 0.001;
|
fTime += 0.001;
|
||||||
@ -1283,6 +1322,7 @@ public void SQL_CheckSelf(Database db, DBResultSet results, const char[] error,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
CPrintToChat(iclient, "You have no time yet!");
|
CPrintToChat(iclient, "You have no time yet!");
|
||||||
|
delete results;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
@ -62,7 +62,7 @@ public void SQL_addEntry(int client)
|
|||||||
g_dDatabase.Escape(sName, sEscapedName, size2 + 1);
|
g_dDatabase.Escape(sName, sEscapedName, size2 + 1);
|
||||||
GetClientIP(client, sIP, sizeof(sIP));
|
GetClientIP(client, sIP, sizeof(sIP));
|
||||||
Format(sQuery, sizeof(sQuery), "insert into `ban_detector_steamids` (`steamid`, `name`, `ID`) SELECT '%s', '%s', bd.ID from `ban_detector` bd where bd.ip = '%s' and not exists (select bds.ID from `ban_detector_steamids` bds where bds.ID = bd.ID and bds.steamid = '%s')", sSID, sEscapedName, sIP, sSID);
|
Format(sQuery, sizeof(sQuery), "insert into `ban_detector_steamids` (`steamid`, `name`, `ID`) SELECT '%s', '%s', bd.ID from `ban_detector` bd where bd.ip = '%s' and not exists (select bds.ID from `ban_detector_steamids` bds where bds.ID = bd.ID and bds.steamid = '%s')", sSID, sEscapedName, sIP, sSID);
|
||||||
g_dDatabase.Query(SQL_UpdateEntry, sQuery, client, DBPrio_Low);
|
g_dDatabase.Query(SQL_UpdateEntry, sQuery, GetClientSerial(client), DBPrio_Low);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SQL_OnDatabaseConnect(Database db, const char[] error, any data)
|
public void SQL_OnDatabaseConnect(Database db, const char[] error, any data)
|
||||||
@ -79,18 +79,25 @@ public void SQL_OnDatabaseConnect_sb(Database db, const char[] error, any data)
|
|||||||
{
|
{
|
||||||
if(!db || strlen(error))
|
if(!db || strlen(error))
|
||||||
{
|
{
|
||||||
LogError("Database error: %s", error);
|
LogError("Database error: %s", error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
g_hDatabase_sourceban = db;
|
g_hDatabase_sourceban = db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void SQL_UpdateEntry(Database db, DBResultSet results, const char[] error, int client)
|
public void SQL_UpdateEntry(Database db, DBResultSet results, const char[] error, int Serial)
|
||||||
{
|
{
|
||||||
if(!db || strlen(error))
|
if(!db || strlen(error))
|
||||||
{
|
{
|
||||||
LogError("Database error: %s", error);
|
LogError("Database error: %s", error);
|
||||||
|
delete results;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int client;
|
||||||
|
if ((client = GetClientFromSerial(Serial)) == 0)
|
||||||
|
{
|
||||||
|
delete results;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (IsValidClient(client))
|
if (IsValidClient(client))
|
||||||
@ -102,16 +109,28 @@ public void SQL_UpdateEntry(Database db, DBResultSet results, const char[] error
|
|||||||
GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID));
|
GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID));
|
||||||
Format(sQuery, sizeof(sQuery), "SELECT bd.fingerprint FROM `ban_detector` bd inner join `ban_detector_steamids` bds on bd.ID = bds.ID where bds.steamid = '%s' or bd.ip = '%s'", sSID, sIP);
|
Format(sQuery, sizeof(sQuery), "SELECT bd.fingerprint FROM `ban_detector` bd inner join `ban_detector_steamids` bds on bd.ID = bds.ID where bds.steamid = '%s' or bd.ip = '%s'", sSID, sIP);
|
||||||
//PrintToChatAll("sQuery: %s", sQuery);
|
//PrintToChatAll("sQuery: %s", sQuery);
|
||||||
g_dDatabase.Query(SQL_FindFingerPrints, sQuery, client, DBPrio_Low);
|
g_dDatabase.Query(SQL_FindFingerPrints, sQuery, GetClientSerial(client), DBPrio_Low);
|
||||||
}
|
}
|
||||||
delete results;
|
delete results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SQL_FindFingerPrints(Database db, DBResultSet results, const char[] error, int client)
|
public void SQL_FindFingerPrints(Database db, DBResultSet results, const char[] error, int Serial)
|
||||||
{
|
{
|
||||||
if (!db || strlen(error))
|
if (!db || strlen(error))
|
||||||
{
|
{
|
||||||
LogError("Database error: %s", error);
|
LogError("Database error: %s", error);
|
||||||
|
delete results;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int client;
|
||||||
|
if ((client = GetClientFromSerial(Serial)) == 0)
|
||||||
|
{
|
||||||
|
delete results;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!IsValidClient(client))
|
||||||
|
{
|
||||||
|
delete results;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char fingerprint[1024];
|
char fingerprint[1024];
|
||||||
@ -123,7 +142,7 @@ public void SQL_FindFingerPrints(Database db, DBResultSet results, const char[]
|
|||||||
g_dDatabase.Escape(fingerprint, sEscapedFingerPrint, 1024);
|
g_dDatabase.Escape(fingerprint, sEscapedFingerPrint, 1024);
|
||||||
Format(sQuery, sizeof(sQuery), "select steamid, ip from ban_detector bd inner join ban_detector_steamids bds on bd.ID = bds.ID where fingerprint = '%s'", sEscapedFingerPrint);
|
Format(sQuery, sizeof(sQuery), "select steamid, ip from ban_detector bd inner join ban_detector_steamids bds on bd.ID = bds.ID where fingerprint = '%s'", sEscapedFingerPrint);
|
||||||
//PrintToChatAll("sQuery: %s", sQuery);
|
//PrintToChatAll("sQuery: %s", sQuery);
|
||||||
g_dDatabase.Query(SQL_checkSourcebans, sQuery, client, DBPrio_Low);
|
g_dDatabase.Query(SQL_checkSourcebans, sQuery, GetClientSerial(client), DBPrio_Low);
|
||||||
if (IsValidClient(client) && g_bReportedClientBanAvoiding[client])
|
if (IsValidClient(client) && g_bReportedClientBanAvoiding[client])
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
@ -132,14 +151,26 @@ public void SQL_FindFingerPrints(Database db, DBResultSet results, const char[]
|
|||||||
delete results;
|
delete results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SQL_checkSourcebans(Database db, DBResultSet results, const char[] error, int client)
|
public void SQL_checkSourcebans(Database db, DBResultSet results, const char[] error, int Serial)
|
||||||
{
|
{
|
||||||
if (!db || strlen(error))
|
if (!db || strlen(error))
|
||||||
{
|
{
|
||||||
|
delete results;
|
||||||
LogError("Database error: %s", error);
|
LogError("Database error: %s", error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int client;
|
||||||
|
if ((client = GetClientFromSerial(Serial)) == 0)
|
||||||
|
{
|
||||||
|
delete results;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!IsValidClient(client))
|
||||||
|
{
|
||||||
|
delete results;
|
||||||
|
return;
|
||||||
|
}
|
||||||
while (results.RowCount > 0 && results.FetchRow())
|
while (results.RowCount > 0 && results.FetchRow())
|
||||||
{
|
{
|
||||||
char sSID[MAX_NAME_LENGTH];
|
char sSID[MAX_NAME_LENGTH];
|
||||||
@ -151,7 +182,7 @@ public void SQL_checkSourcebans(Database db, DBResultSet results, const char[] e
|
|||||||
//PrintToChatAll(sIP);
|
//PrintToChatAll(sIP);
|
||||||
// + 3600 for one hour to accomdate timezone difference
|
// + 3600 for one hour to accomdate timezone difference
|
||||||
Format(sql_statement, sizeof(sql_statement), "select authid, ip from sb_bans where ((ip = '%s' and ip is not null and ip != '') or (authid = '%s' and authid is not null and authid =! '')) and (RemoveType != 'U' or RemoveType is NULL) and (ends > UNIX_TIMESTAMP() + 3600 or ends = created) order by created desc limit 1", sIP, sSID);
|
Format(sql_statement, sizeof(sql_statement), "select authid, ip from sb_bans where ((ip = '%s' and ip is not null and ip != '') or (authid = '%s' and authid is not null and authid =! '')) and (RemoveType != 'U' or RemoveType is NULL) and (ends > UNIX_TIMESTAMP() + 3600 or ends = created) order by created desc limit 1", sIP, sSID);
|
||||||
g_hDatabase_sourceban.Query(sql_select_sb_bans, sql_statement, client, DBPrio_Low);
|
g_hDatabase_sourceban.Query(sql_select_sb_bans, sql_statement, GetClientSerial(client), DBPrio_Low);
|
||||||
if (IsValidClient(client) && g_bReportedClientBanAvoiding[client])
|
if (IsValidClient(client) && g_bReportedClientBanAvoiding[client])
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
@ -160,14 +191,21 @@ public void SQL_checkSourcebans(Database db, DBResultSet results, const char[] e
|
|||||||
delete results;
|
delete results;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sql_select_sb_bans(Database db, DBResultSet results, const char[] error, int client)
|
public void sql_select_sb_bans(Database db, DBResultSet results, const char[] error, int Serial)
|
||||||
{
|
{
|
||||||
if (!db || strlen(error))
|
if (!db || strlen(error))
|
||||||
{
|
{
|
||||||
|
delete results;
|
||||||
LogError("Database error: %s", error);
|
LogError("Database error: %s", error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int client;
|
||||||
|
if ((client = GetClientFromSerial(Serial)) == 0)
|
||||||
|
{
|
||||||
|
delete results;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!IsValidClient(client))
|
if (!IsValidClient(client))
|
||||||
{
|
{
|
||||||
delete results;
|
delete results;
|
||||||
|
Loading…
Reference in New Issue
Block a user