changed how to evaluate if time is better

This commit is contained in:
christian 2021-06-30 17:42:45 +02:00
parent 80823c2901
commit ee95d3582e

View File

@ -576,21 +576,34 @@ public void FinishedStageRaceZone(int client)
CPrintToChat(client, "{green}[UNLOZE] Client: %N Time: %s", client, sTime);
int stage = player_stage[client];
char sQuery[g_dLength];
if (l_iZoneCount < 2)
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table` SET `%s` = '%s', name = '%s' WHERE steam_auth = '%s' and LENGTH(`%s`) >= LENGTH('%s') and STRCMP(`%s`, '%s') > 0", g_cMapname, sTime, sEscapedName, sSID, g_cMapname, sTime, g_cMapname, sTime);
else
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table` SET `%sS%i` = '%s', name = '%s' WHERE steam_auth = '%s' and LENGTH(`%sS%i`) >= LENGTH('%s') and STRCMP(`%sS%i`, '%s') > 0", g_cMapname, stage, sTime, sEscapedName, sSID, g_cMapname, stage, sTime, g_cMapname, stage, sTime);
if (StrEqual(g_csTime_record[client], "0.000"))
{
CPrintToChat(client, "Your record: None yet\nCommand: !toptime !mytime !stages");
if (l_iZoneCount < 2)
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table` SET `%s` = '%s', name = '%s' WHERE steam_auth = '%s'", g_cMapname, sTime, sEscapedName, sSID);
else
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table` SET `%sS%i` = '%s', name = '%s' WHERE steam_auth = '%s'", g_cMapname, stage, sTime, sEscapedName, sSID);
}
else
{
CPrintToChat(client, "Your record: %s\nCommand: !toptime !mytime !stages", g_csTime_record[client]);
}
if (l_iZoneCount < 2)
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table` SET `%s` = '%s', name = '%s' WHERE steam_auth = '%s'", g_cMapname, sTime, sEscapedName, sSID);
else
Format(sQuery, sizeof(sQuery), "UPDATE `zetimer_table` SET `%sS%i` = '%s', name = '%s' WHERE steam_auth = '%s'", g_cMapname, stage, sTime, sEscapedName, sSID);
int generic_length = 32;
char[][] sPart = new char[2][generic_length];
float old_client_time = 0.0;
if (StrContains(g_csTime_record[client], ":") != -1)
{
ExplodeString(g_csTime_record[client], ":", sPart, 2, generic_length);
old_client_time = (StringToFloat(sPart[0]) * 60) + StringToFloat(sPart[1]);
}
else
{
old_client_time = StringToFloat(g_csTime_record[client]);
}
if (client_time >= old_client_time)
{
return;
}
DataPack hDataPack = new DataPack();
hDataPack.WriteString(sQuery);
g_dDatabase.Query(SQL_FinishedQuery, sQuery, hDataPack, DBPrio_High);