From 7ddd33ef0de4147698c93b68bc3fcf960d455b4d Mon Sep 17 00:00:00 2001 From: jenz Date: Sun, 30 Apr 2023 15:21:36 +0200 Subject: [PATCH] deleting result sets, some bug fixes etc --- RaceTimer/scripting/unloze_racetimer_redux.sp | 15 ++++++++++----- .../scripting/unloze_player_time.sp | 17 +++++++++++++++++ .../scripting/jenz_ban_detector.sp | 9 +++++++-- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/RaceTimer/scripting/unloze_racetimer_redux.sp b/RaceTimer/scripting/unloze_racetimer_redux.sp index 9e85a4a3..97ab1063 100755 --- a/RaceTimer/scripting/unloze_racetimer_redux.sp +++ b/RaceTimer/scripting/unloze_racetimer_redux.sp @@ -90,8 +90,13 @@ public void OnPluginStart() g_bDisplaySpecial = unloze_gBSpecialMapDisplay(); } -public Action allow_leaving_again(Handle hTimer, int client) +public Action allow_leaving_again(Handle hTimer, int Serial) { + int client; + if ((client = GetClientFromSerial(Serial)) == 0) + { + return; + } if (IsValidClient(client)) { g_bClient_allowed_to_leave_again[client] = true; @@ -121,7 +126,7 @@ public void trigger_teleport(const char[] output, int entity_index, int client, resetClientVectors(client); g_bClient_allowed_to_leave_again[client] = false; PrintToChat(client, "Disabled timer due to potential teleport abuse, type 1."); - CreateTimer(1.0, allow_leaving_again, client); + CreateTimer(1.0, allow_leaving_again, GetClientSerial(client)); } } } @@ -137,7 +142,7 @@ public void Trigger_Multiple(const char[] output, int entity_index, int client, resetClientVectors(client); g_bClient_allowed_to_leave_again[client] = false; PrintToChat(client, "Disabled timer due to potential teleport abuse, type 1."); - CreateTimer(1.0, allow_leaving_again, client); + CreateTimer(1.0, allow_leaving_again, GetClientSerial(client)); } } } @@ -524,7 +529,7 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float resetClientVectors(client); g_bClient_allowed_to_leave_again[client] = false; PrintToChat(client, "Disabled timer due to potential teleport abuse, type 2."); - CreateTimer(1.0, allow_leaving_again, client); + CreateTimer(1.0, allow_leaving_again, GetClientSerial(client)); return; } int frameCap = 11; @@ -734,7 +739,7 @@ public void CheckIfSpecialRoundZones(char[] resultstart, char[] resultend) //---------------------------------------------------------------------------------------------------- public void CheckifAntiZones(int client, bool reset) { - if (reset) + if (reset && g_bHumansAllowedTime[client]) { g_bHumansAllowedTime[client] = false; PrintToChat(client, "Disabled Timer due to using illegal shortcut"); diff --git a/discord_verificiation/scripting/unloze_player_time.sp b/discord_verificiation/scripting/unloze_player_time.sp index 9f3a1664..9d650412 100644 --- a/discord_verificiation/scripting/unloze_player_time.sp +++ b/discord_verificiation/scripting/unloze_player_time.sp @@ -235,11 +235,16 @@ public void SQL_OnQueryCompletedTimeServer(Database db, DBResultSet results, con { if (!db || strlen(error)) { + delete results; LogError("Query error 3: %s", error); + return; } int client; if ((client = GetClientFromSerial(iSerial)) == 0) + { + delete results; return; + } int iTime_Server; @@ -249,6 +254,11 @@ public void SQL_OnQueryCompletedTimeServer(Database db, DBResultSet results, con } delete results; int iHours_Server = (iTime_Server / 60) / 60; + //just a hardcap, maybe it will be adapted somewhen in the future + if (iHours_Server > 5000) + { + iHours_Server = 5000; + } g_iPlayerTimeServer[client] = iHours_Server; } @@ -376,7 +386,9 @@ public void SQL_OnQueryCompletedTopTime(Database db, DBResultSet results, const { if (!db || strlen(error)) { + delete results; LogError("Query error 3: %s", error); + return; } int iTime; @@ -411,11 +423,16 @@ public void SQL_OnQueryCompletedTime(Database db, DBResultSet results, const cha { if (!db || strlen(error)) { + delete results; LogError("Query error 3: %s", error); + return; } int client; if ((client = GetClientFromSerial(iSerial)) == 0) + { + delete results; return; + } int iTime_ze; int iTime_mg; diff --git a/jenz_ban_detector/scripting/jenz_ban_detector.sp b/jenz_ban_detector/scripting/jenz_ban_detector.sp index 4db079bf..9f18a77c 100644 --- a/jenz_ban_detector/scripting/jenz_ban_detector.sp +++ b/jenz_ban_detector/scripting/jenz_ban_detector.sp @@ -273,12 +273,17 @@ public void OnClientDisconnect(int client) public void OnClientPostAdminCheck(int client) { validate_state[client] = -1; - CreateTimer(10.0, make_db_entry, client); + CreateTimer(10.0, make_db_entry, GetClientSerial(client)); g_bReportedClientBanAvoiding[client] = false; } -public Action make_db_entry(Handle hTimer, int client) +public Action make_db_entry(Handle hTimer, int Serial) { + int client; + if ((client = GetClientFromSerial(Serial)) == 0) + { + return; + } if (IsValidClient(client)) { validate_state[client] = 0;