deleting result sets, some bug fixes etc

This commit is contained in:
jenz 2023-04-30 15:21:36 +02:00
parent 334b5bbde4
commit 7ddd33ef0d
3 changed files with 34 additions and 7 deletions

View File

@ -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");

View File

@ -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;

View File

@ -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;